From 520f4564da41723513b49d72e307f5843dfecb2b Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 11 Apr 2023 23:48:21 -0400 Subject: curl/non-jsonc compat tweaks --- configure.ac | 3 ++- debuginfod/debuginfod-client.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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, -- cgit v1.2.1