http: try http_proxy env var when http.proxy config option is not set
PATCH v2 2/3 http: try http_proxy env var when http.proxy config option is not set
CuRL already reads it, but if $http_proxy has username but no password curl will not ask you for the password.. so we read it ourselves to detect that and ask for the password.
--- http.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
http.c +7 -0
@@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)if (curl_ftp_no_epsv)curl_easy_setopt (result,CURLOPT_FTP_USE_EPSV ,0 ); +if (!curl_http_proxy) { +const char *env_proxy; + env_proxy =getenv ("http_proxy" ); +if (env_proxy) { + curl_http_proxy =xstrdup (env_proxy); + } + }if (curl_http_proxy) {curl_easy_setopt (result,CURLOPT_PROXY , curl_http_proxy);curl_easy_setopt (result,CURLOPT_PROXYAUTH ,CURLAUTH_ANY );
Signature · 1 line
1.7.7.6
Quoted 3 lines · Nelson Benitez Leon
CuRL already reads it, but if $http_proxy has username but no password curl will not ask you for the password.. so we read it ourselves to detect that and ask for the password.
That's not what this change does. This change explicitly loads from the environment the 'http_proxy' variable and sets up curl to use it. As Junio said, this is (on its own) a regression.
Sam
Quoted 23 lines
Signed-off-by Nelson Benitez Leon<[email protected]>--- http.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)http.c +7
-0@@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)if (curl_ftp_no_epsv)curl_easy_setopt (result,CURLOPT_FTP_USE_EPSV ,0 ); +if (!curl_http_proxy) { +const char *env_proxy; + env_proxy =getenv ("http_proxy" ); +if (env_proxy) { + curl_http_proxy =xstrdup (env_proxy); + } + }if (curl_http_proxy) {curl_easy_setopt (result,CURLOPT_PROXY , curl_http_proxy);curl_easy_setopt (result,CURLOPT_PROXYAUTH ,CURLAUTH_ANY );
Quoted 8 lines · Sam Vilain
Quoted 3 lines · Nelson Benitez Leon
CuRL already reads it, but if $http_proxy has username but no password curl will not ask you for the password.. so we read it ourselves to detect that and ask for the password.
That's not what this change does. This change explicitly loads from the environment the '
http_proxy' variable and sets up curl to use it. As Junio said, this is (on its own) a regression.
Just to make sure there is no understanding down the road, I only expressed a concern that this _might_ be a regression. That Mac OS X behaviour is not something I observed first-hand.
Quoted 3 lines · Nelson Benitez Leon
CuRL already reads it, but if $http_proxy has username but no password curl will not ask you for the password.. so we read it ourselves to detect that and ask for the password.
Please stop the double-dot. Also your capitalization for cURL is screwed up.
More importantly, please describe what happens after "will not ask". "will not ask you for the password and the connection fails"? "will not ask you for the password and the gives an error message saying 'authentication failure'"?
The logic in the patch, needless to say, seems OK, though.
Thanks.
Quoted 24 lines
Signed-off-by Nelson Benitez Leon <[email protected]>--- http.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)http.c +7
-0@@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)if (curl_ftp_no_epsv)curl_easy_setopt (result,CURLOPT_FTP_USE_EPSV ,0 ); +if (!curl_http_proxy) { +const char *env_proxy; + env_proxy =getenv ("http_proxy" ); +if (env_proxy) { + curl_http_proxy =xstrdup (env_proxy); + } + }if (curl_http_proxy) {curl_easy_setopt (result,CURLOPT_PROXY , curl_http_proxy);curl_easy_setopt (result,CURLOPT_PROXYAUTH ,CURLAUTH_ANY );
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Nelson Benitez Leon
CuRL already reads it, but if $http_proxy has username but no password curl will not ask you for the password.. so we read it ourselves to detect that and ask for the password.
Quoted 7 lines
Please stop the double-dot. Also your capitalization for cURL is screwed up.
More importantly, please describe what happens after "will not ask". "will not ask you for the password and the connection fails"? "will not ask you for the password and the gives an error message saying 'authentication failure'"?
When we need to authenticate for the destination webserver, we detect an HTTP 401, _then_ ask for the credentials, and retry the request. I'm curious what the error condition is for the authentication failure, and if we can do the same here (from a brief skim of rfc2616, it looks like it should be a 407, but I do not even have a proxy set up to try).
-Peff
Quoted 4 lines · Jeff King
When we need to authenticate for the destination webserver, we detect an HTTP 401, _then_ ask for the credentials, and retry the request. I'm curious what the error condition is for the authentication failure, and if we can do the same here.
Yeah, that would be ideal.