diff mbox series

[3/5] http: correct version check for CURL_HTTP_VERSION_2_0

Message ID patch-3.5-d8192164937-20210908T152807Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series post-v2.33 "drop support for ancient curl" follow-up | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 8, 2021, 3:31 p.m. UTC
In d73019feb44 (http: add support selecting http version, 2018-11-08)
a dependency was added on CURL_HTTP_VERSION_2_0, but this feature was
introduced in curl version 7.43.0, not 7.47.0, as the incorrect
version check led us to believe.

As looking through the history of that commit on the mailing list will
reveal[1], the reason for this is that an earlier version of it
depended on CURL_HTTP_VERSION_2TLS, which was introduced in libcurl
7.47.0.

But the version that made it in in d73019feb44 had dropped the
dependency on CURL_HTTP_VERSION_2TLS, but the corresponding version
check was not corrected.

1. https://lore.kernel.org/git/pull.69.git.gitgitgadget@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jeff King Sept. 8, 2021, 7:27 p.m. UTC | #1
On Wed, Sep 08, 2021 at 05:31:54PM +0200, Ævar Arnfjörð Bjarmason wrote:

> In d73019feb44 (http: add support selecting http version, 2018-11-08)
> a dependency was added on CURL_HTTP_VERSION_2_0, but this feature was
> introduced in curl version 7.43.0, not 7.47.0, as the incorrect
> version check led us to believe.
> 
> As looking through the history of that commit on the mailing list will
> reveal[1], the reason for this is that an earlier version of it
> depended on CURL_HTTP_VERSION_2TLS, which was introduced in libcurl
> 7.47.0.
> 
> But the version that made it in in d73019feb44 had dropped the
> dependency on CURL_HTTP_VERSION_2TLS, but the corresponding version
> check was not corrected.

According to the curl manpage, if we use CURL_HTTP_VERSION_2_0 instead,
it goes all the way to 7.33.0. I don't have opinion on whether that's
worth covering or not.

-Peff
diff mbox series

Patch

diff --git a/http.c b/http.c
index f7d5b6a0776..b19d0a697d8 100644
--- a/http.c
+++ b/http.c
@@ -730,7 +730,7 @@  static long get_curl_allowed_protocols(int from_user)
 	return allowed_protocols;
 }
 
-#if LIBCURL_VERSION_NUM >=0x072f00
+#if LIBCURL_VERSION_NUM >=0x072b00
 static int get_curl_http_version_opt(const char *version_string, long *opt)
 {
 	int i;
@@ -772,7 +772,7 @@  static CURL *get_curl_handle(void)
 		curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
 	}
 
-#if LIBCURL_VERSION_NUM >= 0x072f00 // 7.47.0
+#if LIBCURL_VERSION_NUM >= 0x072b00
     if (curl_http_version) {
 		long opt;
 		if (!get_curl_http_version_opt(curl_http_version, &opt)) {