Re: [PATCH 1/6] http: try http_proxy env var when http.proxy config option is not set
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:43
Nelson Benitez Leon [off-list ref] writes:
cURL already reads it, but if $http_proxy has username but no password
cURL will not ask you for the password and so failed to authenticate
returning a 407 error code. So we read it ourselves to detect that and
ask for the password. Also we read it prior to connection to be able to
make a proactive authentication in case the flag http_proactive_auth is
set.
We also take care to read env proxy var according to protocol being
used in the destination url, e.g. when the url to retrieve is a https
one, then the proxy env var we look at is https_proxy. We also look at
the uppercase version of these if the lowercase is not found, with the
exception of HTTP_PROXY because cURL ignores it. To make this possible
we now passed destination url parameter to get_active_slot() and
get_curl_handle() functions.
We also read no_proxy env var so to ignore aforementioned proxy env var
if no_proxy contains an asterisk ('*') or contains the host used in url
destination.
Signed-off-by: Nelson Benitez Leon <redacted>
Signed-off-by: Junio C Hamano <redacted>I'll trust Peff to point out anything I missed, but from a cursory look, the result looks much cleaner than the previous round.
quoted hunk
diff --git a/http.c b/http.c index 5cb87f1..64df7b1 100644 --- a/http.c +++ b/http.c@@ -229,6 +229,37 @@ static void init_curl_http_auth(CURL *result)... +static int host_allowed_by_noproxy_env (const char *host) +{
I'll queue the updated series with s/_env (/_env(/; here, and also add a
missing explanation on the bulk of "noise" in the patch at the end of the
log message:
In order to be able to determine what proxy settings is needed from
the very beginning of a request, get_active_slot() learns to take the
destination URL, as it needs to pass it to get_curl_handle() that
implements the logic to pick proxies based on the protocol used.
Thanks.