{"thread":{"id":"29799","subject":"[PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","startedAt":"2012-03-01T17:45:35Z","lastAt":"2012-03-01T21:38:28Z","messageCount":6,"participants":["Nelson Benitez Leon","Sam Vilain","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"185834","messageId":"4F4FB5BF.8000904@vilain.net","threadId":"29799","inReplyTo":"4F4FBE0F.6020004@seap.minhap.es","subject":"Re: [PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2012-03-01T17:45:35Z","receivedAt":"2012-03-01T17:45:35Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On 3/1/12 10:21 AM, Nelson Benitez Leon wrote:\n> CuRL already reads it, but if $http_proxy has username but no password\n> curl will not ask you for the password.. so we read it ourselves to\n> detect that and ask for the password.\n\nThat's not what this change does.  This change explicitly loads from the \nenvironment the 'http_proxy' variable and sets up curl to use it.  As \nJunio said, this is (on its own) a regression.\n\nSam\n\n\n> Signed-off-by: Nelson Benitez Leon<nbenitezl@gmail.com>\n> ---\n>   http.c |    7 +++++++\n>   1 files changed, 7 insertions(+), 0 deletions(-)\n>\n> diff --git a/http.c b/http.c\n> index 8ac8eb6..8932da5 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)\n>   \tif (curl_ftp_no_epsv)\n>   \t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n>\n> +\tif (!curl_http_proxy) {\n> +\t\tconst char *env_proxy;\n> +\t\tenv_proxy = getenv(\"http_proxy\");\n> +\t\tif (env_proxy) {\n> +\t\t\tcurl_http_proxy = xstrdup(env_proxy);\n> +\t\t}\n> +\t}\n>   \tif (curl_http_proxy) {\n>   \t\tcurl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);\n>   \t\tcurl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);\n"},{"id":"185832","messageId":"4F4FBE0F.6020004@seap.minhap.es","threadId":"29799","inReplyTo":null,"subject":"[PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","fromName":"Nelson Benitez Leon","fromEmail":"nelsonjesus.benitez@seap.minhap.es","sentAt":"2012-03-01T18:21:03Z","receivedAt":"2012-03-01T18:21:03Z","isPatch":true,"sender":{"key":"nelsonjesus.benitez@seap.minhap.es","avatar":null},"body":"CuRL already reads it, but if $http_proxy has username but no password\ncurl will not ask you for the password.. so we read it ourselves to\ndetect that and ask for the password.\n\nSigned-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>\n---\n http.c |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 8ac8eb6..8932da5 100644\n--- a/http.c\n+++ b/http.c\n@@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)\n \tif (curl_ftp_no_epsv)\n \t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n\n+\tif (!curl_http_proxy) {\n+\t\tconst char *env_proxy;\n+\t\tenv_proxy = getenv(\"http_proxy\");\n+\t\tif (env_proxy) {\n+\t\t\tcurl_http_proxy = xstrdup(env_proxy);\n+\t\t}\n+\t}\n \tif (curl_http_proxy) {\n \t\tcurl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);\n \t\tcurl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);\n-- \n1.7.7.6\n"},{"id":"185837","messageId":"7v7gz4npby.fsf@alter.siamese.dyndns.org","threadId":"29799","inReplyTo":"4F4FB5BF.8000904@vilain.net","subject":"Re: [PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-01T18:33:37Z","receivedAt":"2012-03-01T18:33:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam@vilain.net> writes:\n\n> On 3/1/12 10:21 AM, Nelson Benitez Leon wrote:\n>> CuRL already reads it, but if $http_proxy has username but no password\n>> curl will not ask you for the password.. so we read it ourselves to\n>> detect that and ask for the password.\n>\n> That's not what this change does.  This change explicitly loads from\n> the environment the 'http_proxy' variable and sets up curl to use it.\n> As Junio said, this is (on its own) a regression.\n\nJust to make sure there is no understanding down the road, I only\nexpressed a concern that this _might_ be a regression. That Mac OS X\nbehaviour is not something I observed first-hand.\n"},{"id":"185841","messageId":"7vy5rkm91t.fsf@alter.siamese.dyndns.org","threadId":"29799","inReplyTo":"4F4FBE0F.6020004@seap.minhap.es","subject":"Re: [PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-01T19:10:38Z","receivedAt":"2012-03-01T19:10:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es> writes:\n\n> CuRL already reads it, but if $http_proxy has username but no password\n> curl will not ask you for the password.. so we read it ourselves to\n> detect that and ask for the password.\n\nPlease stop the double-dot.  Also your capitalization for cURL is screwed\nup.\n\nMore importantly, please describe what happens after \"will not ask\".\n\"will not ask you for the password and the connection fails\"?\n\"will not ask you for the password and the gives an error message saying\n'authentication failure'\"?\n\nThe logic in the patch, needless to say, seems OK, though.\n\nThanks.\n\n>\n> Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>\n> ---\n>  http.c |    7 +++++++\n>  1 files changed, 7 insertions(+), 0 deletions(-)\n>\n> diff --git a/http.c b/http.c\n> index 8ac8eb6..8932da5 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -295,6 +295,13 @@ static CURL *get_curl_handle(void)\n>  \tif (curl_ftp_no_epsv)\n>  \t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n>\n> +\tif (!curl_http_proxy) {\n> +\t\tconst char *env_proxy;\n> +\t\tenv_proxy = getenv(\"http_proxy\");\n> +\t\tif (env_proxy) {\n> +\t\t\tcurl_http_proxy = xstrdup(env_proxy);\n> +\t\t}\n> +\t}\n>  \tif (curl_http_proxy) {\n>  \t\tcurl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);\n>  \t\tcurl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);\n"},{"id":"185851","messageId":"20120301210129.GD17631@sigill.intra.peff.net","threadId":"29799","inReplyTo":"7vy5rkm91t.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-03-01T21:01:29Z","receivedAt":"2012-03-01T21:01:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 01, 2012 at 11:10:38AM -0800, Junio C Hamano wrote:\n\n> Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es> writes:\n> \n> > CuRL already reads it, but if $http_proxy has username but no password\n> > curl will not ask you for the password.. so we read it ourselves to\n> > detect that and ask for the password.\n> \n> Please stop the double-dot.  Also your capitalization for cURL is screwed\n> up.\n> \n> More importantly, please describe what happens after \"will not ask\".\n> \"will not ask you for the password and the connection fails\"?\n> \"will not ask you for the password and the gives an error message saying\n> 'authentication failure'\"?\n\nWhen we need to authenticate for the destination webserver, we detect an\nHTTP 401, _then_ ask for the credentials, and retry the request. I'm\ncurious what the error condition is for the authentication failure, and\nif we can do the same here (from a brief skim of rfc2616, it looks like\nit should be a 407, but I do not even have a proxy set up to try).\n\n-Peff\n"},{"id":"185853","messageId":"7vty28knmz.fsf@alter.siamese.dyndns.org","threadId":"29799","inReplyTo":"20120301210129.GD17631@sigill.intra.peff.net","subject":"Re: [PATCH v2 2/3] http: try http_proxy env var when http.proxy config option is not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-01T21:38:28Z","receivedAt":"2012-03-01T21:38:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> When we need to authenticate for the destination webserver, we detect an\n> HTTP 401, _then_ ask for the credentials, and retry the request. I'm\n> curious what the error condition is for the authentication failure, and\n> if we can do the same here.\n\nYeah, that would be ideal.\n"}]}