{"thread":{"id":"41568","subject":"[PATCH] http: honor no_http env variable to bypass proxy","startedAt":"2016-02-29T15:16:57Z","lastAt":"2016-03-10T08:50:13Z","messageCount":5,"participants":["Jiang Xin","Junio C Hamano","Elia Pinto"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"279784","messageId":"5652e025323b60ccf5a59bcbdc7266d4f4e32fc4.1456758964.git.xin.jiang@huawei.com","threadId":"41568","inReplyTo":null,"subject":"[PATCH] http: honor no_http env variable to bypass proxy","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2016-02-29T15:16:57Z","receivedAt":"2016-02-29T15:16:57Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"From: Jiang Xin <xin.jiang@huawei.com>\n\nCurl and its families honor several proxy related environment variables:\n\n* http_proxy and https_proxy define proxy for http/https connections.\n* no_proxy (a comma separated hosts) defines hosts bypass the proxy.\n\nThis command will bypass the bad-proxy and connect to the host directly:\n\n    no_proxy=* https_proxy=http://bad-proxy/ \\\n    curl -sk https://google.com/\n\nBefore commit 372370f (http: use credential API to handle proxy auth...),\nEnvironment variable \"no_proxy\" will take effect if the config variable\n\"http.proxy\" is not set.  So the following comamnd won't fail if not\nbehind a firewall.\n\n    no_proxy=* https_proxy=http://bad-proxy/ \\\n    git ls-remote https://github.com/git/git\n\nBut commit 372370f not only read git config variable \"http.proxy\", but\nalso read \"http_proxy\" and \"https_proxy\" environment variables, and set\nthe curl option using:\n\n    curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n\nThis caused \"no_proxy\" environment variable not working any more.\n\nSet extra curl option \"CURLOPT_NOPROXY\" will fix this issue.\n\nSigned-off-by: Jiang Xin <xin.jiang@huawei.com>\n---\n http.c | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/http.c b/http.c\nindex 1d5e3bb..69da445 100644\n--- a/http.c\n+++ b/http.c\n@@ -70,6 +70,7 @@ static long curl_low_speed_limit = -1;\n static long curl_low_speed_time = -1;\n static int curl_ftp_no_epsv;\n static const char *curl_http_proxy;\n+static const char *curl_no_proxy;\n static const char *http_proxy_authmethod;\n static struct {\n \tconst char *name;\n@@ -624,6 +625,11 @@ static CURL *get_curl_handle(void)\n \t\t}\n \n \t\tcurl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n+#if LIBCURL_VERSION_NUM >= 0x071304\n+\t\tvar_override(&curl_no_proxy, getenv(\"NO_PROXY\"));\n+\t\tvar_override(&curl_no_proxy, getenv(\"no_proxy\"));\n+\t\tcurl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);\n+#endif\n \t}\n \tinit_curl_proxy_auth(result);\n \n-- \n2.8.0.rc0.1.g9eb3984.dirty\n"},{"id":"279829","messageId":"xmqqio179uxn.fsf@gitster.mtv.corp.google.com","threadId":"41568","inReplyTo":"5652e025323b60ccf5a59bcbdc7266d4f4e32fc4.1456758964.git.xin.jiang@huawei.com","subject":"Re: [PATCH] http: honor no_http env variable to bypass proxy","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-02-29T19:29:40Z","receivedAt":"2016-02-29T19:29:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jiang Xin <worldhello.net@gmail.com> writes:\n\n> From: Jiang Xin <xin.jiang@huawei.com>\n>\n> Curl and its families honor several proxy related environment variables:\n>\n> * http_proxy and https_proxy define proxy for http/https connections.\n> * no_proxy (a comma separated hosts) defines hosts bypass the proxy.\n>\n> This command will bypass the bad-proxy and connect to the host directly:\n>\n>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>     curl -sk https://google.com/\n>\n> Before commit 372370f (http: use credential API to handle proxy auth...),\n> Environment variable \"no_proxy\" will take effect if the config variable\n> \"http.proxy\" is not set.  So the following comamnd won't fail if not\n> behind a firewall.\n>\n>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>     git ls-remote https://github.com/git/git\n>\n> But commit 372370f not only read git config variable \"http.proxy\", but\n> also read \"http_proxy\" and \"https_proxy\" environment variables, and set\n> the curl option using:\n>\n>     curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n>\n> This caused \"no_proxy\" environment variable not working any more.\n>\n> Set extra curl option \"CURLOPT_NOPROXY\" will fix this issue.\n>\n> Signed-off-by: Jiang Xin <xin.jiang@huawei.com>\n> ---\n>  http.c | 6 ++++++\n>  1 file changed, 6 insertions(+)\n\nSounds sensible; I am guessing that this is 2.8.0-rc0 regression\nthat we need to fast-track?\n\nKnut, does this look good?\n\nThanks.\n\n> diff --git a/http.c b/http.c\n> index 1d5e3bb..69da445 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -70,6 +70,7 @@ static long curl_low_speed_limit = -1;\n>  static long curl_low_speed_time = -1;\n>  static int curl_ftp_no_epsv;\n>  static const char *curl_http_proxy;\n> +static const char *curl_no_proxy;\n>  static const char *http_proxy_authmethod;\n>  static struct {\n>  \tconst char *name;\n> @@ -624,6 +625,11 @@ static CURL *get_curl_handle(void)\n>  \t\t}\n>  \n>  \t\tcurl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n> +#if LIBCURL_VERSION_NUM >= 0x071304\n> +\t\tvar_override(&curl_no_proxy, getenv(\"NO_PROXY\"));\n> +\t\tvar_override(&curl_no_proxy, getenv(\"no_proxy\"));\n> +\t\tcurl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);\n> +#endif\n>  \t}\n>  \tinit_curl_proxy_auth(result);\n"},{"id":"280333","messageId":"xmqqr3fmni4d.fsf@gitster.mtv.corp.google.com","threadId":"41568","inReplyTo":"xmqqio179uxn.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] http: honor no_http env variable to bypass proxy","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-07T20:33:06Z","receivedAt":"2016-03-07T20:33:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\nSecond call for help.  I hate having to revert 30f302f7 (Merge\nbranch 'kf/http-proxy-auth-methods', 2016-02-03) this late in the\ncycle.\n\n> Jiang Xin <worldhello.net@gmail.com> writes:\n>\n>> From: Jiang Xin <xin.jiang@huawei.com>\n>>\n>> Curl and its families honor several proxy related environment variables:\n>>\n>> * http_proxy and https_proxy define proxy for http/https connections.\n>> * no_proxy (a comma separated hosts) defines hosts bypass the proxy.\n>>\n>> This command will bypass the bad-proxy and connect to the host directly:\n>>\n>>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>>     curl -sk https://google.com/\n>>\n>> Before commit 372370f (http: use credential API to handle proxy auth...),\n>> Environment variable \"no_proxy\" will take effect if the config variable\n>> \"http.proxy\" is not set.  So the following comamnd won't fail if not\n>> behind a firewall.\n>>\n>>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>>     git ls-remote https://github.com/git/git\n>>\n>> But commit 372370f not only read git config variable \"http.proxy\", but\n>> also read \"http_proxy\" and \"https_proxy\" environment variables, and set\n>> the curl option using:\n>>\n>>     curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n>>\n>> This caused \"no_proxy\" environment variable not working any more.\n>>\n>> Set extra curl option \"CURLOPT_NOPROXY\" will fix this issue.\n>>\n>> Signed-off-by: Jiang Xin <xin.jiang@huawei.com>\n>> ---\n>>  http.c | 6 ++++++\n>>  1 file changed, 6 insertions(+)\n>\n> Sounds sensible; I am guessing that this is 2.8.0-rc0 regression\n> that we need to fast-track?\n>\n> Knut, does this look good?\n>\n> Thanks.\n>\n>> diff --git a/http.c b/http.c\n>> index 1d5e3bb..69da445 100644\n>> --- a/http.c\n>> +++ b/http.c\n>> @@ -70,6 +70,7 @@ static long curl_low_speed_limit = -1;\n>>  static long curl_low_speed_time = -1;\n>>  static int curl_ftp_no_epsv;\n>>  static const char *curl_http_proxy;\n>> +static const char *curl_no_proxy;\n>>  static const char *http_proxy_authmethod;\n>>  static struct {\n>>  \tconst char *name;\n>> @@ -624,6 +625,11 @@ static CURL *get_curl_handle(void)\n>>  \t\t}\n>>  \n>>  \t\tcurl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n>> +#if LIBCURL_VERSION_NUM >= 0x071304\n>> +\t\tvar_override(&curl_no_proxy, getenv(\"NO_PROXY\"));\n>> +\t\tvar_override(&curl_no_proxy, getenv(\"no_proxy\"));\n>> +\t\tcurl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);\n>> +#endif\n>>  \t}\n>>  \tinit_curl_proxy_auth(result);\n"},{"id":"280536","messageId":"CA+EOSBkfj1bt+yf2KQTzVoAPRkbB6MGUaJEmJV54Efz+0FOOwg@mail.gmail.com","threadId":"41568","inReplyTo":"5652e025323b60ccf5a59bcbdc7266d4f4e32fc4.1456758964.git.xin.jiang@huawei.com","subject":"Re: [PATCH] http: honor no_http env variable to bypass proxy","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2016-03-10T08:46:01Z","receivedAt":"2016-03-10T08:46:01Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"2016-02-29 16:16 GMT+01:00 Jiang Xin <worldhello.net@gmail.com>:\n> From: Jiang Xin <xin.jiang@huawei.com>\n>\n> Curl and its families honor several proxy related environment variables:\n>\n> * http_proxy and https_proxy define proxy for http/https connections.\n> * no_proxy (a comma separated hosts) defines hosts bypass the proxy.\n>\n> This command will bypass the bad-proxy and connect to the host directly:\n>\n>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>     curl -sk https://google.com/\n>\n> Before commit 372370f (http: use credential API to handle proxy auth...),\n> Environment variable \"no_proxy\" will take effect if the config variable\n> \"http.proxy\" is not set.  So the following comamnd won't fail if not\n> behind a firewall.\n>\n>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>     git ls-remote https://github.com/git/git\n>\n> But commit 372370f not only read git config variable \"http.proxy\", but\n> also read \"http_proxy\" and \"https_proxy\" environment variables, and set\n> the curl option using:\n>\n>     curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n>\n> This caused \"no_proxy\" environment variable not working any more.\n>\n> Set extra curl option \"CURLOPT_NOPROXY\" will fix this issue.\n>\n> Signed-off-by: Jiang Xin <xin.jiang@huawei.com>\nSigned-off-by: Elia Pinto <gitter.spiros@gmail.com>\n> ---\n>  http.c | 6 ++++++\n>  1 file changed, 6 insertions(+)\n>\n> diff --git a/http.c b/http.c\n> index 1d5e3bb..69da445 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -70,6 +70,7 @@ static long curl_low_speed_limit = -1;\n>  static long curl_low_speed_time = -1;\n>  static int curl_ftp_no_epsv;\n>  static const char *curl_http_proxy;\n> +static const char *curl_no_proxy;\n>  static const char *http_proxy_authmethod;\n>  static struct {\n>         const char *name;\n> @@ -624,6 +625,11 @@ static CURL *get_curl_handle(void)\n>                 }\n>\n>                 curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n> +#if LIBCURL_VERSION_NUM >= 0x071304\n> +               var_override(&curl_no_proxy, getenv(\"NO_PROXY\"));\n> +               var_override(&curl_no_proxy, getenv(\"no_proxy\"));\n> +               curl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);\n> +#endif\n>         }\n>         init_curl_proxy_auth(result);\n>\n> --\n> 2.8.0.rc0.1.g9eb3984.dirty\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"280537","messageId":"CA+EOSBmaWNrpvPiiYZJ270UeAbKVcBS2d2Tr5byoW4HX9R79Hw@mail.gmail.com","threadId":"41568","inReplyTo":"xmqqr3fmni4d.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] http: honor no_http env variable to bypass proxy","fromName":"Elia Pinto","fromEmail":"gitter.spiros@gmail.com","sentAt":"2016-03-10T08:50:13Z","receivedAt":"2016-03-10T08:50:13Z","isPatch":true,"sender":{"key":"gitter.spiros@gmail.com","avatar":"https://avatars.githubusercontent.com/u/158490?v=4"},"body":"2016-03-07 21:33 GMT+01:00 Junio C Hamano <gitster@pobox.com>:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n> Second call for help.  I hate having to revert 30f302f7 (Merge\n> branch 'kf/http-proxy-auth-methods', 2016-02-03) this late in the\n> cycle.\nOk. I made the original merge commit for master. So,  if it is\nsufficient, for me the patch is correct.\n\nI am sorry for the delay in the response.\n\nBest\n>\n>> Jiang Xin <worldhello.net@gmail.com> writes:\n>>\n>>> From: Jiang Xin <xin.jiang@huawei.com>\n>>>\n>>> Curl and its families honor several proxy related environment variables:\n>>>\n>>> * http_proxy and https_proxy define proxy for http/https connections.\n>>> * no_proxy (a comma separated hosts) defines hosts bypass the proxy.\n>>>\n>>> This command will bypass the bad-proxy and connect to the host directly:\n>>>\n>>>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>>>     curl -sk https://google.com/\n>>>\n>>> Before commit 372370f (http: use credential API to handle proxy auth...),\n>>> Environment variable \"no_proxy\" will take effect if the config variable\n>>> \"http.proxy\" is not set.  So the following comamnd won't fail if not\n>>> behind a firewall.\n>>>\n>>>     no_proxy=* https_proxy=http://bad-proxy/ \\\n>>>     git ls-remote https://github.com/git/git\n>>>\n>>> But commit 372370f not only read git config variable \"http.proxy\", but\n>>> also read \"http_proxy\" and \"https_proxy\" environment variables, and set\n>>> the curl option using:\n>>>\n>>>     curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n>>>\n>>> This caused \"no_proxy\" environment variable not working any more.\n>>>\n>>> Set extra curl option \"CURLOPT_NOPROXY\" will fix this issue.\n>>>\n>>> Signed-off-by: Jiang Xin <xin.jiang@huawei.com>\n>>> ---\n>>>  http.c | 6 ++++++\n>>>  1 file changed, 6 insertions(+)\n>>\n>> Sounds sensible; I am guessing that this is 2.8.0-rc0 regression\n>> that we need to fast-track?\n>>\n>> Knut, does this look good?\n>>\n>> Thanks.\n>>\n>>> diff --git a/http.c b/http.c\n>>> index 1d5e3bb..69da445 100644\n>>> --- a/http.c\n>>> +++ b/http.c\n>>> @@ -70,6 +70,7 @@ static long curl_low_speed_limit = -1;\n>>>  static long curl_low_speed_time = -1;\n>>>  static int curl_ftp_no_epsv;\n>>>  static const char *curl_http_proxy;\n>>> +static const char *curl_no_proxy;\n>>>  static const char *http_proxy_authmethod;\n>>>  static struct {\n>>>      const char *name;\n>>> @@ -624,6 +625,11 @@ static CURL *get_curl_handle(void)\n>>>              }\n>>>\n>>>              curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);\n>>> +#if LIBCURL_VERSION_NUM >= 0x071304\n>>> +            var_override(&curl_no_proxy, getenv(\"NO_PROXY\"));\n>>> +            var_override(&curl_no_proxy, getenv(\"no_proxy\"));\n>>> +            curl_easy_setopt(result, CURLOPT_NOPROXY, curl_no_proxy);\n>>> +#endif\n>>>      }\n>>>      init_curl_proxy_auth(result);\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}