ostree-fetcher-curl: explicitly use HTTP1.1 when HTTP2 is disabled
authorDylan Aïssi <dylan.aissi@collabora.com>
Thu, 15 Jun 2023 12:29:47 +0000 (14:29 +0200)
committerDylan Aïssi <dylan.aissi@collabora.com>
Thu, 15 Jun 2023 13:41:16 +0000 (15:41 +0200)
The current logic to select the HTTP version to be use relies on
the fact that curl don't use by default HTTP2. This assumption seems wrong with
recent versions of curl.

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
src/libostree/ostree-fetcher-curl.c

index d12d049a153d6ca905d2dd4f57a82b653307ae5e..9d07e5e10c32a08748c7618cb333d81cc340f29c 100644 (file)
@@ -879,6 +879,12 @@ initiate_next_curl_request (FetcherRequest *req, GTask *task)
 #endif
     }
 
+  if (self->config_flags & OSTREE_FETCHER_FLAGS_DISABLE_HTTP2)
+    {
+      rc = curl_easy_setopt (req->easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+      g_assert_cmpint (rc, ==, CURLM_OK);
+    }
+
   rc = curl_easy_setopt (req->easy, CURLOPT_WRITEFUNCTION, write_cb);
   g_assert_cmpint (rc, ==, CURLM_OK);
   rc = curl_easy_setopt (req->easy, CURLOPT_HEADERFUNCTION, response_header_cb);