Skip to content

Commit 7bdd2b5

Browse files
authored
set CURLOPT_ENCODING to nullptr in case of curl7 (#2737)
* set CURLOPT_ENCODING to nullptr in case of curl7 Curl 7 introduced more strictness how it handles CURLOPT_ENCODING. With earlier versions it as apparently okay when the server sent an encoding curl did not implement. Newer versions are much more stricter and refuse to complete downloads under such circumstances. This leads to almost nothing loading. The culrpit seemingly being either the simulator or asset servers sending headers curls does not accept. The workaround is to set CURLOPT_ENCODING to nullptr rather than "". This does come with the implication that curl will not handle decompression transparently, rather this burden gets shifted to the application. It will also not send Accept-Encoding headers automatically. * Adapt a few more occurences of CURLOPT_ENCODING for curl >= 7
1 parent 7ff655a commit 7bdd2b5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

indra/llcorehttp/_httpoprequest.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,12 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
513513
check_curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1);
514514
check_curl_easy_setopt(mCurlHandle, CURLOPT_URL, mReqURL.c_str());
515515
check_curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, getHandle());
516-
check_curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, "");
516+
517+
#if LIBCURL_VERSION_MAJOR > 7
518+
check_curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, nullptr);
519+
#else
520+
check_curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, "");
521+
#endif
517522

518523
check_curl_easy_setopt(mCurlHandle, CURLOPT_AUTOREFERER, 1);
519524
check_curl_easy_setopt(mCurlHandle, CURLOPT_MAXREDIRS, HTTP_REDIRECTS_DEFAULT);
@@ -603,7 +608,12 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
603608
case HOR_POST:
604609
{
605610
check_curl_easy_setopt(mCurlHandle, CURLOPT_POST, 1);
611+
612+
#if LIBCURL_VERSION_MAJOR > 7
613+
check_curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, nullptr);
614+
#else
606615
check_curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, "");
616+
#endif
607617
long data_size(0);
608618
if (mReqBody)
609619
{

indra/llcorehttp/httpcommon.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@ CURL *getCurlTemplateHandle()
289289
check_curl_code(result, CURLOPT_NOSIGNAL);
290290
result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_NOPROGRESS, 1);
291291
check_curl_code(result, CURLOPT_NOPROGRESS);
292+
293+
#if LIBCURL_VERSION_MAJOR > 7
294+
result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_ENCODING, nullptr);
295+
#else
292296
result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_ENCODING, "");
297+
#endif
298+
293299
check_curl_code(result, CURLOPT_ENCODING);
294300
result = curl_easy_setopt(curlpTemplateHandle, CURLOPT_AUTOREFERER, 1);
295301
check_curl_code(result, CURLOPT_AUTOREFERER);

0 commit comments

Comments
 (0)