Re: git 2.8.1 not working with socks5h https proxy anymore

2016-04-09 Thread Felix Ruess
Thanks a lot!
Tested the patch and it works as expected :-)

On Fri, Apr 8, 2016 at 9:16 PM, Junio C Hamano  wrote:
> Felix Ruess  writes:
>
>> 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'
>
> The first version of Git that has code that explicitly supports
> socks proxy is 2.6.4, it seems.  Since then we have always used
> CURLPROXY_SOCKS5 for curl_http_proxy that begins with a string
> "socks5".
>
> Checking
>
> https://github.com/curl/curl/blob/master/docs/libcurl/symbols-in-versions
>
> I find that that at curl 7.18.0, curl added a separate
> CURLPROXY_SOCKS5_HOSTNAME that can be triggered by "socks5h:" that
> is separate from CURLPROXY_SOCKS5, and I am guessing that the
> differences in behaviour between these two is what is causing you
> trouble.  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)
>
> and because not using _HOSTNAME variant would likely not ask the
> proxy to do the resolving, it explains the stall on your end, if
> your box cannot resolve external hostname.
>
> Perhaps the attached patch may help?
>
> I do not know if Pat is still active as a developer, but I am
> wondering what the reason was to use starts_with(..., "socks5")
> instead of "socks5:", "socks4a:", etc. when identifying the proxy
> type.
>
>  http.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> 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"))
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


git 2.8.1 not working with socks5h https proxy anymore

2016-04-08 Thread Felix Ruess
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).

Cheers, Felix
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html