From 98d2f30dff5797c1e528123058ea0df7d5504fda Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 21 Feb 2022 00:37:35 +0100 Subject: [PATCH] Do not ask for compression when using libcurl >= 7.81 due to the AWS CDN returning an invlid Content-Encoding header --- indra/llcorehttp/_httpoprequest.cpp | 5 +++++ indra/llcorehttp/httpcommon.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 8eccae00c7..b94a243fb2 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -508,7 +508,12 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) check_curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1); check_curl_easy_setopt(mCurlHandle, CURLOPT_URL, mReqURL.c_str()); check_curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, getHandle()); + +// Newer versions of curl are stricter with checkinng Cotent-Encoding: header +// Aws returns Content-Encoding: binary/octet-stream which is no valid scheme defined by HTTP/1.1 (compress,deflate, gzip) +#if LIBCURL_VERSION_NUM < 0x075100 check_curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, ""); +#endif check_curl_easy_setopt(mCurlHandle, CURLOPT_AUTOREFERER, 1); check_curl_easy_setopt(mCurlHandle, CURLOPT_MAXREDIRS, HTTP_REDIRECTS_DEFAULT); diff --git a/indra/llcorehttp/httpcommon.cpp b/indra/llcorehttp/httpcommon.cpp index 61ba83594e..8012da4370 100644 --- a/indra/llcorehttp/httpcommon.cpp +++ b/indra/llcorehttp/httpcommon.cpp @@ -289,8 +289,12 @@ CURL *getCurlTemplateHandle() check_curl_code(result, CURLOPT_NOSIGNAL); result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_NOPROGRESS, 1); check_curl_code(result, CURLOPT_NOPROGRESS); +// Newer versions of curl are stricter with checkinng Cotent-Encoding: header +// Aws returns Content-Encoding: binary/octet-stream which is no valid scheme defined by HTTP/1.1 (compress,deflate, gzip) +#if LIBCURL_VERSION_NUM < 0x075100 result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_ENCODING, ""); check_curl_code(result, CURLOPT_ENCODING); +#endif result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_AUTOREFERER, 1); check_curl_code(result, CURLOPT_AUTOREFERER); result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_FOLLOWLOCATION, 1);