From c1d0b46cd45b5cbb832db697b434889b17e9bda5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 6 Feb 2023 15:53:52 +0000 Subject: [PATCH] utils-http: Avoid deprecation warning with curl >= 7.85.0 CURLOPT_PROTOCOLS_STR is documented as the replacement for CURLOPT_PROTOCOLS. Signed-off-by: Simon McVittie --- common/flatpak-utils-http.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/flatpak-utils-http.c b/common/flatpak-utils-http.c index e180345a..a2a21c9c 100644 --- a/common/flatpak-utils-http.c +++ b/common/flatpak-utils-http.c @@ -373,7 +373,11 @@ flatpak_create_http_session (const char *user_agent) g_mutex_init (&session->lock); curl_easy_setopt (curl, CURLOPT_USERAGENT, user_agent); +#if CURL_AT_LEAST_VERSION(7, 85, 0) + rc = curl_easy_setopt (curl, CURLOPT_PROTOCOLS_STR, "http,https"); +#else rc = curl_easy_setopt (curl, CURLOPT_PROTOCOLS, (long)(CURLPROTO_HTTP | CURLPROTO_HTTPS)); +#endif g_assert_cmpint (rc, ==, CURLM_OK); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);