fix: when setting Accept-Encoding to identity, disable curl decoding. (#4609)

Also, change `CURLOPT_ENCODING` usage to `CURLOPT_ACCEPT_ENCODING`.
This key was renamed upstream in 7.21.6; our CURL_MINIMUM is 7.28.0.

Fixes #753.
This commit is contained in:
Charles Kerr 2023-01-17 16:07:10 -06:00 committed by GitHub
parent 75876e92e0
commit 3bc1a1be04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -506,7 +506,7 @@ public:
(void)curl_easy_setopt(e, CURLOPT_SHARE, shared());
(void)curl_easy_setopt(e, CURLOPT_DNS_CACHE_TIMEOUT, DnsCacheTimeoutSecs);
(void)curl_easy_setopt(e, CURLOPT_AUTOREFERER, 1L);
(void)curl_easy_setopt(e, CURLOPT_ENCODING, "");
(void)curl_easy_setopt(e, CURLOPT_ACCEPT_ENCODING, "");
(void)curl_easy_setopt(e, CURLOPT_FOLLOWLOCATION, 1L);
(void)curl_easy_setopt(e, CURLOPT_MAXREDIRS, -1L);
(void)curl_easy_setopt(e, CURLOPT_NOSIGNAL, 1L);
@ -576,7 +576,8 @@ public:
if (auto const& range = task.range(); range)
{
/* don't bother asking the server to compress webseed fragments */
(void)curl_easy_setopt(e, CURLOPT_ENCODING, "identity");
(void)curl_easy_setopt(e, CURLOPT_ACCEPT_ENCODING, "identity");
(void)curl_easy_setopt(e, CURLOPT_HTTP_CONTENT_DECODING, 0L);
(void)curl_easy_setopt(e, CURLOPT_RANGE, range->c_str());
}
}