Jeff King [off-list ref] writes:
Don't we explicitly not want to do this when the protocol is http? Curl
doesn't respect HTTP_PROXY.
Yes. Here is what I'll queue.
-- >8 --
From: Nelson Benitez Leon <redacted>
Date: Thu, 26 Apr 2012 15:16:51 +0200
Subject: [PATCH] http: try an uppercase version of $proto_proxy
Fall back to an uppercase version of $prot_proxy environment variable
when the lowercase version is not found (but do not do that for http).
Signed-off-by: Nelson Benitez Leon <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
http.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/http.c b/http.c
index ad2dc36..262778b 100644
--- a/http.c
+++ b/http.c
@@ -320,6 +320,12 @@ static CURL *get_curl_handle(const char *url)
strbuf_addf(&buf, "%s_proxy", cre_url.protocol);
env_proxy_var = strbuf_detach(&buf, NULL);
env_proxy = getenv(env_proxy_var);
+ if (!env_proxy && strcmp("http_proxy", env_proxy_var)) {
+ char *p;
+ for (p = env_proxy_var; *p; p++)
+ *p = toupper(*p);
+ env_proxy = getenv(env_proxy_var);
+ }
if (env_proxy) {
read_http_proxy = 1;
no_proxy = getenv("no_proxy");--
1.7.10.475.g8b959
On 04/26/2012 05:18 PM, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
Don't we explicitly not want to do this when the protocol is http? Curl
doesn't respect HTTP_PROXY.
Yes. Here is what I'll queue.
Fine. You beat me on time, anyway I send you my version just for the sake
of having done it.
From 66c5e59f486088d12b48a2e624a98242e7ebce46 Mon Sep 17 00:00:00 2001
From: Nelson Benitez Leon <redacted>
Date: Thu, 26 Apr 2012 14:44:03 +0200
Subject: [PATCH] http: try an uppercase version of $prot_proxy env var
If the lowercase version of $prot_proxy is not found
then try the uppercase one, excluding HTTP_PROXY case
as it is ignored by cURL.
Signed-off-by: Nelson Benitez Leon <redacted>
---
http.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index 6a98195..0ca5bba 100644
--- a/http.c
+++ b/http.c
@@ -329,6 +329,13 @@ static CURL *get_curl_handle(const char *url)
strbuf_addf(&buf, "%s_proxy", cre_url.protocol);
env_proxy_var = strbuf_detach(&buf, NULL);
env_proxy = getenv(env_proxy_var);
+ if (!env_proxy && strcmp("http", cre_url.protocol)) { /* skip HTTP_PROXY as cURL ignores it */
+ char *p;
+ for (p = env_proxy_var; *p; p++) {
+ *p = toupper(*p);
+ }
+ env_proxy = getenv(env_proxy_var);
+ }
if (env_proxy) {
read_http_proxy = 1;
no_proxy = getenv("no_proxy");--
1.7.7.6
On Thu, Apr 26, 2012 at 08:18:58AM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
Don't we explicitly not want to do this when the protocol is http? Curl
doesn't respect HTTP_PROXY.
Yes. Here is what I'll queue.
I had raised several other points in my (admittedly belated) review[1].
So I was kind of expecting a re-roll rather than a patch on top. It was
mostly readability issues, but there is also a potential segfault when
the url has no protocol. I'm not sure it can happen in normal git use,
but:
git remote-https url-without-protocol
may dereference null (it's via snprintf, so on my system glibc magically
rewrites this as "(null)_proxy", but other systems will segfault).
-Peff
[1] http://article.gmane.org/gmane.comp.version-control.git/195443
http://article.gmane.org/gmane.comp.version-control.git/195445