aboutsummaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2016-02-03 04:09:14 +0000
committerJunio C Hamano <gitster@pobox.com>2016-02-12 11:34:14 -0800
commitc915f11eb4922e154e29cf62d3b549d65c06a170 (patch)
treec318d28aff355a3a42a6b7accc3fa0e71588584d /remote-curl.c
parentf3ee9ca53bc04e9770747ea58951135d60b11a8d (diff)
downloadgit-c915f11eb4922e154e29cf62d3b549d65c06a170.tar.gz
git-c915f11eb4922e154e29cf62d3b549d65c06a170.tar.xz
connect & http: support -4 and -6 switches for remote operations
Sometimes it is necessary to force IPv4-only or IPv6-only operation on networks where name lookups may return a non-routable address and stall remote operations. The ssh(1) command has an equivalent switches which we may pass when we run them. There may be old ssh(1) implementations out there which do not support these switches; they should report the appropriate error in that case. rsync support is untouched for now since it is deprecated and scheduled to be removed. Signed-off-by: Eric Wong <normalperson@yhbt.net> Reviewed-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/remote-curl.c b/remote-curl.c
index f404faf0f..70bcac818 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -119,6 +119,19 @@ static int set_option(const char *name, const char *value)
else
return -1;
return 0;
+
+#if LIBCURL_VERSION_NUM >= 0x070a08
+ } else if (!strcmp(name, "family")) {
+ if (!strcmp(value, "ipv4"))
+ git_curl_ipresolve = CURL_IPRESOLVE_V4;
+ else if (!strcmp(value, "ipv6"))
+ git_curl_ipresolve = CURL_IPRESOLVE_V6;
+ else if (!strcmp(value, "all"))
+ git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER;
+ else
+ return -1;
+ return 0;
+#endif /* LIBCURL_VERSION_NUM >= 0x070a08 */
} else {
return 1 /* unsupported */;
}