git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git 2.8.1 not working with socks5h https proxy anymore

From
Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date
Apr 8, 2016, 19:07 UTC
Message-ID
<1460142453.32486.2.camel@kaarsemaker.net>
In-Reply-To
<CAEc+GFeG-ZdeTXGsjmwV0QP6QwYvjA4nzCGitka0aXjqEkatfg@mail.gmail.com>
On vr, 2016-04-08 at 20:46 +0200, Felix Ruess wrote:
Show 29 quoted lines
> Hi all,
> 
> I just encountered a problem with the latest git version (2.8.1) that
> looks like a regression to me:
> When trying to clone a repo via a https socks5 proxy the connection
> times out:
> 
> $ git config --global 'http.proxy=socks5h://127.0.0.1:1080'
> $ export GIT_CURL_VERBOSE=1
> $ git clone https://foo.de/bar.git
> Cloning into 'bar'...
> * Couldn't find host foo.de in the .netrc file; using defaults
> * Hostname was NOT found in DNS cache
> *   Trying 127.0.0.1...
> * Hostname was NOT found in DNS cache
> * 80
> * 147
> * 201
> * 194
> channel 2: open failed: connect failed: Connection timed out
> channel 4: open failed: connect failed: Connection timed out
> * Failed to receive SOCKS5 connect request ack.
> * Closing connection 0
> fatal: unable to access 'https://foo.de/bar.git/': Failed to receive
> SOCKS5 connect request ack.
> 
> I'm on Ubuntu 14.04 64bit and it works perfectly fine with git 1.9.1
> (and was also working with older git 2.x versions, although not sure
> any more what the last working version was).

I think that's 6d7afe07f29df75f831a46fb0f657fa37e561779, which interprets that as a socks5 proxy.

I think this should fix it (but haven't tested it beyond 'it compiles'):

diff --git a/http.c b/http.c
index 69da445..4304b80 100644
--- a/http.c
+++ b/http.c
@@ -605,7 +605,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"))

But I have no socks5h proxy to test with. Can you give this patch a spin?
-- 
Dennis Kaarsemaker
www.kaarsemaker.net
Previous: Felix RuessNext: Junio C Hamano
Message 2 of 5 in “git 2.8.1 not working with socks5h https proxy anymore”
  1. Felix RuessApr 8, 2016
  2. Dennis KaarsemakerApr 8, 2016
  3. Junio C HamanoApr 8, 2016
  4. Felix RuessApr 9, 2016
  5. Junio C HamanoApr 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.