summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2023-04-11 23:48:21 -0400
committerFrank Ch. Eigler <fche@redhat.com>2023-04-11 23:48:21 -0400
commit520f4564da41723513b49d72e307f5843dfecb2b (patch)
treec6c84f6578d6142bef1b3da17da9e83945870e4d
parente428fc4e8224b7a5e38545ee68da74c59b4013b3 (diff)
downloadelfutils-520f4564da41723513b49d72e307f5843dfecb2b.tar.gz
curl/non-jsonc compat tweaks
-rw-r--r--configure.ac3
-rw-r--r--debuginfod/debuginfod-client.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index ba4d412f..b319a011 100644
--- a/configure.ac
+++ b/configure.ac
@@ -665,7 +665,8 @@ case "$ac_cv_search__obstack_free" in
esac
AC_SUBST([obstack_LIBS])
-AC_CHECK_LIB(json-c, json_object_array_add, [
+dnl formerly checked for json_object_array_add, but debuginfod needs a newer function
+AC_CHECK_LIB(json-c, json_object_from_fd, [
AC_DEFINE([HAVE_JSON_C], [1], [Define if json-c is on the machine])
AC_SUBST(jsonc_LIBS, '-ljson-c')
])
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index cf7c3fcb..a2be3edf 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -180,10 +180,12 @@ static const char *cache_miss_filename = "cache_miss_s";
static const char *cache_max_unused_age_filename = "max_unused_age_s";
static const long cache_default_max_unused_age_s = 604800; /* 1 week */
+#ifdef HAVE_JSON_C
/* The metadata_retention_default_s file within the debuginfod cache
specifies how long metadata query results should be cached. */
static const long metadata_retention_default_s = 86400; /* 1 day */
static const char *metadata_retention_filename = "metadata_retention_s";
+#endif
/* Location of the cache of files downloaded from debuginfods.
The default parent directory is $HOME, or '/' if $HOME doesn't exist. */
@@ -720,8 +722,12 @@ init_handle(debuginfod_client *client,
/* 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->handle, CURLOPT_PROTOCOLS_STR, "http,https,file");
+#else
curl_easy_setopt_ck(data->handle, CURLOPT_PROTOCOLS,
(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
+#endif
curl_easy_setopt_ck(data->handle, CURLOPT_URL, data->url);
if (vfd >= 0)
curl_easy_setopt_ck(data->handle, CURLOPT_ERRORBUFFER,