jobcore/elfutils/curl_7.85_compat.patch

61 lines
2.4 KiB
Diff
Raw Normal View History

2023-01-22 17:59:52 +01:00
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index a16165bd1..1ce456327 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1336,8 +1336,13 @@ debuginfod_query_server (debuginfod_client *c,
/* Only allow http:// + https:// + file:// so we aren't being
redirected to some unsupported protocol. */
+#if CURL_AT_LEAST_VERSION(7, 85, 0)
+ curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS_STR,
+ "http,https,file");
+#else
curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS,
(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
+#endif
curl_easy_setopt_ck(data[i].handle, CURLOPT_URL, data[i].url);
if (vfd >= 0)
curl_easy_setopt_ck(data[i].handle, CURLOPT_ERRORBUFFER,
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 8873fcc8c..692aeccec 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1456,7 +1456,7 @@ debuginfod_query_server (debuginfod_client *c,
deflate-compressing proxies, this number is likely to be
unavailable, so -1 may show. */
CURLcode curl_res;
-#ifdef CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
+#if CURL_AT_LEAST_VERSION(7, 55, 0)
curl_off_t cl;
curl_res = curl_easy_getinfo(target_handle,
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
@@ -1491,7 +1491,7 @@ debuginfod_query_server (debuginfod_client *c,
if (target_handle) /* we've committed to a server; report its download progress */
{
CURLcode curl_res;
-#ifdef CURLINFO_SIZE_DOWNLOAD_T
+#if CURL_AT_LEAST_VERSION(7, 55, 0)
curl_off_t dl;
curl_res = curl_easy_getinfo(target_handle,
CURLINFO_SIZE_DOWNLOAD_T,
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 692aeccec..a16165bd1 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -105,6 +105,13 @@ void debuginfod_end (debuginfod_client *c) { }
#include <fts.h>
#endif
+/* Older curl.h don't define CURL_AT_LEAST_VERSION. */
+#ifndef CURL_AT_LEAST_VERSION
+ #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
+ #define CURL_AT_LEAST_VERSION(x,y,z) \
+ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
+#endif
+
#include <pthread.h>
static pthread_once_t init_control = PTHREAD_ONCE_INIT;
--
2.31.1