From: Junio C Hamano <gitster@pobox.com>
To: Felix Ruess <felix.ruess@gmail.com>
Cc: git@vger.kernel.org, Daniel Stenberg <daniel@haxx.se>,
Pat Thoyts <patthoyts@users.sourceforge.net>
Subject: Re: git 2.8.1 not working with socks5h https proxy anymore
Date: Sun, 10 Apr 2016 11:11:40 -0700 [thread overview]
Message-ID: <xmqqegadtjtv.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAEc+GFerpBC_O4jMvtmUhVdLReEN4nvuz5Q30SFUp8qZnQZBmQ@mail.gmail.com> (Felix Ruess's message of "Sat, 9 Apr 2016 14:05:11 +0200")
Felix Ruess <felix.ruess@gmail.com> writes:
> Thanks a lot!
> Tested the patch and it works as expected :-)
Thanks, lets do this, then.
-- >8 --
Subject: [PATCH] http: differentiate socks5:// and socks5h://
Felix Ruess <felix.ruess@gmail.com> noticed that with configuration
$ git config --global 'http.proxy=socks5h://127.0.0.1:1080'
connections to remote sites time out, waiting for DNS resolution.
The logic to detect various flavours of SOCKS proxy and ask the
libcurl layer to use appropriate one understands the proxy string
that begin with socks5, socks4a, etc., but does not know socks5h,
and we end up using CURLPROXY_SOCKS5. The correct one to use is
CURLPROXY_SOCKS5_HOSTNAME.
https://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html says
..., socks5h:// (the last one to enable socks5 and asking the
proxy to do the resolving, also known as CURLPROXY_SOCKS5_HOSTNAME
type).
which is consistent with the way the breakage was reported.
Tested-by: Felix Ruess <felix.ruess@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
http.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/http.c b/http.c
index c29ce81..b560c13 100644
--- a/http.c
+++ b/http.c
@@ -466,7 +466,10 @@ static CURL *get_curl_handle(void)
if (curl_http_proxy) {
curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
#if LIBCURL_VERSION_NUM >= 0x071800
- if (starts_with(curl_http_proxy, "socks5"))
+ if (starts_with(curl_http_proxy, "socks5h"))
+ curl_easy_setopt(result,
+ CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
+ else if (starts_with(curl_http_proxy, "socks5"))
curl_easy_setopt(result,
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
else if (starts_with(curl_http_proxy, "socks4a"))
--
2.8.1-339-gc925d85
prev parent reply other threads:[~2016-04-10 18:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 18:46 git 2.8.1 not working with socks5h https proxy anymore Felix Ruess
2016-04-08 19:07 ` Dennis Kaarsemaker
2016-04-08 19:16 ` Junio C Hamano
2016-04-09 12:05 ` Felix Ruess
2016-04-10 18:11 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqegadtjtv.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=daniel@haxx.se \
--cc=felix.ruess@gmail.com \
--cc=git@vger.kernel.org \
--cc=patthoyts@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.