All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
To: Felix Ruess <felix.ruess@gmail.com>, git@vger.kernel.org
Subject: Re: git 2.8.1 not working with socks5h https proxy anymore
Date: Fri, 08 Apr 2016 21:07:33 +0200	[thread overview]
Message-ID: <1460142453.32486.2.camel@kaarsemaker.net> (raw)
In-Reply-To: <CAEc+GFeG-ZdeTXGsjmwV0QP6QwYvjA4nzCGitka0aXjqEkatfg@mail.gmail.com>

On vr, 2016-04-08 at 20:46 +0200, Felix Ruess wrote:
> 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

  reply	other threads:[~2016-04-08 19:07 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 [this message]
2016-04-08 19:16 ` Junio C Hamano
2016-04-09 12:05   ` Felix Ruess
2016-04-10 18:11     ` Junio C Hamano

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=1460142453.32486.2.camel@kaarsemaker.net \
    --to=dennis@kaarsemaker.net \
    --cc=felix.ruess@gmail.com \
    --cc=git@vger.kernel.org \
    /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.