From 83b881cdc25403516b2ed9dcb3801c46965bdb4d Mon Sep 17 00:00:00 2001 From: git-bruh Date: Sat, 3 Sep 2022 12:25:07 +0530 Subject: [PATCH] flatpak-utils-http: check for HTTP2 support before trying to use it --- common/flatpak-utils-http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/flatpak-utils-http.c b/common/flatpak-utils-http.c index 317e67ec..828e2568 100644 --- a/common/flatpak-utils-http.c +++ b/common/flatpak-utils-http.c @@ -388,8 +388,10 @@ flatpak_create_http_session (const char *user_agent) * libcurl 7.43.0. */ #if CURL_AT_LEAST_VERSION(7, 51, 0) - rc = curl_easy_setopt (curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); - g_assert_cmpint (rc, ==, CURLM_OK); + if ((curl_version_info (CURLVERSION_NOW))->features & CURL_VERSION_HTTP2) { + rc = curl_easy_setopt (curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); + g_assert_cmpint (rc, ==, CURLM_OK); + } #endif /* https://github.com/curl/curl/blob/curl-7_53_0/docs/examples/http2-download.c */ #if (CURLPIPE_MULTIPLEX > 0)