[PATCH 1/2] Conditional use of CURLOPT_PROXYHEADER based on libcurl version
Signed-off-by: Alejandro R. Sedeño <asedeno@mit.edu>
Signed-off-by: Alejandro R. Sedeño <asedeno@google.com>
---
git-curl-compat.h | 7 +++++++
http.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/git-curl-compat.h b/git-curl-compat.h
index e1d0bdd273..08ae73e0f1 100644
--- a/git-curl-compat.h
+++ b/git-curl-compat.h
@@ -65,6 +65,13 @@
#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
#endif
+/**
+ * CURLOPT_PROXYHEADER was added in 7.37.0, released in May 2014.
+ */
+#if LIBCURL_VERSION_NUM >= 0x072500
+#define GIT_CURL_HAVE_CURLOPT_PROXYHEADER
+#endif
+
/**
* CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
* 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
diff --git a/http.c b/http.c
index d59e59f66b..30d5e4c67b 100644
--- a/http.c
+++ b/http.c
@@ -652,8 +652,12 @@ static void set_proxyauth_name_password(CURL *result)
curl_easy_setopt(result, CURLOPT_PROXYPASSWORD,
proxy_auth.password);
} else if (proxy_auth.authtype && proxy_auth.credential) {
+#ifdef GIT_CURL_HAVE_CURLOPT_PROXYHEADER
curl_easy_setopt(result, CURLOPT_PROXYHEADER,
http_append_auth_header(&proxy_auth, NULL));
+#else
+ warning(_("CURLOPT_PROXYHEADER not supported with cURL < 7.37.0"));
+#endif
}
}
--
2.39.5