From 3bc1a1be049e456f155753a6a0d1f23c86979678 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 17 Jan 2023 16:07:10 -0600 Subject: [PATCH] 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. --- libtransmission/web.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libtransmission/web.cc b/libtransmission/web.cc index 88daa9ef8..1eb175546 100644 --- a/libtransmission/web.cc +++ b/libtransmission/web.cc @@ -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()); } }