From 6d7afe07f29df75f831a46fb0f657fa37e561779 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 26 Oct 2015 14:15:07 +0100 Subject: remote-http(s): support SOCKS proxies With this patch we properly support SOCKS proxies, configured e.g. like this: git config http.proxy socks5://192.168.67.1:32767 Without this patch, Git mistakenly tries to use SOCKS proxies as if they were HTTP proxies, resulting in a error message like: fatal: unable to access 'http://.../': Proxy CONNECT aborted This patch was required to work behind a faulty AP and scraped from http://stackoverflow.com/questions/15227130/#15228479 and guarded with an appropriate cURL version check by Johannes Schindelin. Signed-off-by: Pat Thoyts Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- http.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'http.c') diff --git a/http.c b/http.c index 9448c50f0f..be3f5fb7de 100644 --- a/http.c +++ b/http.c @@ -424,6 +424,17 @@ 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")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + else if (starts_with(curl_http_proxy, "socks4a")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A); + else if (starts_with(curl_http_proxy, "socks")) + curl_easy_setopt(result, + CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); +#endif } #if LIBCURL_VERSION_NUM >= 0x070a07 curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY); -- cgit v1.3 From bf9acba2c121ff0e2ac5b61018f23bc56bbde542 Mon Sep 17 00:00:00 2001 From: Charles Bailey Date: Mon, 23 Nov 2015 12:02:40 +0000 Subject: http: treat config options sslCAPath and sslCAInfo as paths This enables ~ and ~user expansion for these config options. Signed-off-by: Charles Bailey Signed-off-by: Jeff King --- http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'http.c') diff --git a/http.c b/http.c index 0f924a8b48..0bce727f13 100644 --- a/http.c +++ b/http.c @@ -215,10 +215,10 @@ static int http_options(const char *var, const char *value, void *cb) #endif #if LIBCURL_VERSION_NUM >= 0x070908 if (!strcmp("http.sslcapath", var)) - return git_config_string(&ssl_capath, var, value); + return git_config_pathname(&ssl_capath, var, value); #endif if (!strcmp("http.sslcainfo", var)) - return git_config_string(&ssl_cainfo, var, value); + return git_config_pathname(&ssl_cainfo, var, value); if (!strcmp("http.sslcertpasswordprotected", var)) { ssl_cert_password_required = git_config_bool(var, value); return 0; -- cgit v1.3