]> git.ipfire.org Git - thirdparty/git.git/commit - http.c
http: differentiate socks5:// and socks5h://
authorJunio C Hamano <gitster@pobox.com>
Fri, 8 Apr 2016 19:16:06 +0000 (12:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Apr 2016 18:03:17 +0000 (11:03 -0700)
commit87f8a0b279def4da439b5e0e41f517a05ef110f0
tree13dbacf22094f3aed66648a6b4cc49f19046538f
parente46579643d56162299b1756b70d418005351b256
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