summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-01-09 10:09:52 +0100
committerFrantisek Sumsal <frantisek@sumsal.cz>2023-01-09 12:43:37 +0100
commit2285c462ebb0b5d9a7043719a4f0d684a5dc37c2 (patch)
treee20bfffa3fd9eaf80c35321ebb24c709c27ee040 /src/import
parent4f79f545b3c46c358666c9f5f2b384fe50aac4b4 (diff)
downloadsystemd-2285c462ebb0b5d9a7043719a4f0d684a5dc37c2.tar.gz
import: use CURLINFO_SCHEME instead of CURLINFO_PROTOCOL
CURLINFO_PROTOCOL has been deprecated in curl 7.85.0 causing compilation warnings/errors: ../build/src/import/pull-job.c: In function ‘pull_job_curl_on_finished’: ../build/src/import/pull-job.c:142:9: error: ‘CURLINFO_PROTOCOL’ is deprecated: since 7.85.0. Use CURLINFO_SCHEME [-Werror=deprecated-declarations] 142 | code = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); | ^~~~ In file included from ../build/src/import/curl-util.h:4, from ../build/src/import/pull-job.h:6, from ../build/src/import/pull-common.h:7, from ../build/src/import/pull-job.c:16: /usr/include/curl/curl.h:2896:3: note: declared here 2896 | CURLINFO_PROTOCOL CURL_DEPRECATED(7.85.0, "Use CURLINFO_SCHEME") | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Since both CURLINFO_SCHEME and CURLINFO_PROTOCOL were introduced in the same curl version (7.52.0 [0][1]) we don't have to worry about backwards compatibility. [0] https://curl.se/libcurl/c/CURLINFO_SCHEME.html [1] https://curl.se/libcurl/c/CURLINFO_PROTOCOL.html
Diffstat (limited to 'src/import')
-rw-r--r--src/import/pull-job.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/import/pull-job.c b/src/import/pull-job.c
index ce7642e897..d8402f753e 100644
--- a/src/import/pull-job.c
+++ b/src/import/pull-job.c
@@ -124,8 +124,8 @@ static int pull_job_restart(PullJob *j, const char *new_url) {
void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) {
PullJob *j = NULL;
+ char *scheme = NULL;
CURLcode code;
- long protocol;
int r;
if (curl_easy_getinfo(curl, CURLINFO_PRIVATE, (char **)&j) != CURLE_OK)
@@ -139,13 +139,13 @@ void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) {
goto finish;
}
- code = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
- if (code != CURLE_OK) {
- r = log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to retrieve response code: %s", curl_easy_strerror(code));
+ code = curl_easy_getinfo(curl, CURLINFO_SCHEME, &scheme);
+ if (code != CURLE_OK || !scheme) {
+ r = log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to retrieve URL scheme.");
goto finish;
}
- if (IN_SET(protocol, CURLPROTO_HTTP, CURLPROTO_HTTPS)) {
+ if (STRCASE_IN_SET(scheme, "HTTP", "HTTPS")) {
long status;
code = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);