Merge pull request #25982 from mrc0mmand/curl-scheme
Fix build with the latest libcurl
This commit is contained in:
@@ -252,7 +252,11 @@ int curl_glue_make(CURL **ret, const char *url, void *userdata) {
|
||||
if (curl_easy_setopt(c, CURLOPT_LOW_SPEED_LIMIT, 30L) != CURLE_OK)
|
||||
return -EIO;
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x075500 /* libcurl 7.85.0 */
|
||||
if (curl_easy_setopt(c, CURLOPT_PROTOCOLS_STR, "HTTP,HTTPS,FILE") != CURLE_OK)
|
||||
#else
|
||||
if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK)
|
||||
#endif
|
||||
return -EIO;
|
||||
|
||||
*ret = TAKE_PTR(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);
|
||||
|
||||
Reference in New Issue
Block a user