1
#include "git-compat-util.h"
2
+#include "git-curl-compat.h"
3
#include "http.h"
4
#include "config.h"
5
#include "pack.h"
48
{ "sslv2", CURL_SSLVERSION_SSLv2 },
49
{ "sslv3", CURL_SSLVERSION_SSLv3 },
50
{ "tlsv1", CURL_SSLVERSION_TLSv1 },
50
-#if LIBCURL_VERSION_NUM >= 0x072200
51
+#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
52
{ "tlsv1.0", CURL_SSLVERSION_TLSv1_0 },
53
{ "tlsv1.1", CURL_SSLVERSION_TLSv1_1 },
54
{ "tlsv1.2", CURL_SSLVERSION_TLSv1_2 },
55
#endif
55
-#if LIBCURL_VERSION_NUM >= 0x073400
56
+#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3
57
{ "tlsv1.3", CURL_SSLVERSION_TLSv1_3 },
58
#endif
59
};
60
static const char *ssl_key;
61
static const char *ssl_capath;
62
static const char *curl_no_proxy;
62
-#if LIBCURL_VERSION_NUM >= 0x072700
63
+#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
64
static const char *ssl_pinnedkey;
65
#endif
66
static const char *ssl_cainfo;
374
}
375
376
if (!strcmp("http.pinnedpubkey", var)) {
376
-#if LIBCURL_VERSION_NUM >= 0x072700
377
+#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
378
return git_config_pathname(&ssl_pinnedkey, var, value);
379
#else
380
warning(_("Public key pinning not supported with cURL < 7.39.0"));
501
return 1;
502
}
503
503
-#if LIBCURL_VERSION_NUM >= 0x073400
504
+#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
505
static int has_proxy_cert_password(void)
506
{
507
if (http_proxy_ssl_cert == NULL || proxy_ssl_cert_password_required != 1)
517
}
518
#endif
519
519
-#if LIBCURL_VERSION_NUM >= 0x071900
520
+#ifdef GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE
521
static void set_curl_keepalive(CURL *c)
522
{
523
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1);
733
return allowed_protocols;
734
}
735
735
-#if LIBCURL_VERSION_NUM >=0x072b00
736
+#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
737
static int get_curl_http_version_opt(const char *version_string, long *opt)
738
{
739
int i;
775
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
776
}
777
777
-#if LIBCURL_VERSION_NUM >= 0x072b00
778
+#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
779
if (curl_http_version) {
780
long opt;
781
if (!get_curl_http_version_opt(curl_http_version, &opt)) {
806
807
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
808
!http_schannel_check_revoke) {
808
-#if LIBCURL_VERSION_NUM >= 0x072c00
809
+#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
810
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
811
#else
812
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
846
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
847
if (ssl_capath != NULL)
848
curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
848
-#if LIBCURL_VERSION_NUM >= 0x072700
849
+#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
850
if (ssl_pinnedkey != NULL)
851
curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey);
852
#endif
853
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
854
!http_schannel_use_ssl_cainfo) {
855
curl_easy_setopt(result, CURLOPT_CAINFO, NULL);
855
-#if LIBCURL_VERSION_NUM >= 0x073400
856
+#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO
857
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, NULL);
858
#endif
859
} else if (ssl_cainfo != NULL || http_proxy_ssl_ca_info != NULL) {
860
if (ssl_cainfo != NULL)
861
curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
861
-#if LIBCURL_VERSION_NUM >= 0x073400
862
+#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO
863
if (http_proxy_ssl_ca_info != NULL)
864
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, http_proxy_ssl_ca_info);
865
#endif
940
else if (starts_with(curl_http_proxy, "socks"))
941
curl_easy_setopt(result,
942
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
942
-#if LIBCURL_VERSION_NUM >= 0x073400
943
+#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
944
else if (starts_with(curl_http_proxy, "https")) {
945
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
946
1005
free(normalized_url);
1006
string_list_clear(&config.vars, 1);
1007
1007
-#if LIBCURL_VERSION_NUM >= 0x073800
1008
+#ifdef GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
1009
if (http_ssl_backend) {
1010
const curl_ssl_backend **backends;
1011
struct strbuf buf = STRBUF_INIT;