http: correct curl version check for CURLOPT_PINNEDPUBLICKEY

In aeff8a61216 (http: implement public key pinning, 2016-02-15) a dependency and warning() was added if curl older than 7.44.0 was used, but the relevant code depended on CURLOPT_PINNEDPUBLICKEY, introduced in 7.39.0. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 13, 2021 at 16:51 UTC 905a02880473c54f6c817e4ec8262d195d149940
1 file changed +4 -4
http.c
+4 -4
@@ -59,7 +59,7 @@ static struct {
59 static const char *ssl_key;
60 static const char *ssl_capath;
61 static const char *curl_no_proxy;
62 -#if LIBCURL_VERSION_NUM >= 0x072c00
62 +#if LIBCURL_VERSION_NUM >= 0x072700
63 static const char *ssl_pinnedkey;
64 #endif
65 static const char *ssl_cainfo;
@@ -373,10 +373,10 @@ static int http_options(const char *var, const char *value, void *cb)
373 }
374
375 if (!strcmp("http.pinnedpubkey", var)) {
376 -#if LIBCURL_VERSION_NUM >= 0x072c00
376 +#if LIBCURL_VERSION_NUM >= 0x072700
377 return git_config_pathname(&ssl_pinnedkey, var, value);
378 #else
379 - warning(_("Public key pinning not supported with cURL < 7.44.0"));
379 + warning(_("Public key pinning not supported with cURL < 7.39.0"));
380 return 0;
381 #endif
382 }
@@ -845,7 +845,7 @@ static CURL *get_curl_handle(void)
845 curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
846 if (ssl_capath != NULL)
847 curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
848 -#if LIBCURL_VERSION_NUM >= 0x072c00
848 +#if LIBCURL_VERSION_NUM >= 0x072700
849 if (ssl_pinnedkey != NULL)
850 curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey);
851 #endif