Testing using the nightly on linux Mint 22.1
The following encoding headers are being added incorrectly
|
if(version->features & CURL_VERSION_BROTLI) { |
|
headers = curl_slist_append(headers, "Accept-Encoding: br"); |
|
} |
|
if(version->features & CURL_VERSION_LIBZ) { |
|
headers = curl_slist_append(headers, "Accept-Encoding: gzip"); |
|
} |
According to https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html
It should be added as a single string. "Provide them in the string as a comma-separated list of accepted encodings, like: "br, gzip, deflate". "
Testing with the following
std::string encodings = "Accept-Encoding: ";
bool first = true;
if (version->features & CURL_VERSION_BROTLI) {
encodings += "br";
first = false;
}
if (version->features & CURL_VERSION_LIBZ) {
if (!first) {encodings += ", ";}
encodings += "gzip";
first = false;
}
if( !first) {
ofLogNotice("ofURLFileLoader :: encodings") << encodings;
headers = curl_slist_append(headers, encodings.c_str());
}
Using this method with the API I am testing with, it returns gzip data that needs to be decompressed manually. The only way to determine what type of compression (if any) is returned is by passing in verbose as true with ofHTTPRequest.
When testing with the following:
/* enable all supported built-in compressions */
curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, "");
All of the supported compressions are added and curl decompresses the data so that it can be used.
Is there a reason not to use "curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, "");" ?
Testing using the nightly on linux Mint 22.1
The following encoding headers are being added incorrectly
openFrameworks/libs/openFrameworks/utils/ofURLFileLoader.cpp
Lines 344 to 349 in 32971e8
According to https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html
It should be added as a single string. "Provide them in the string as a comma-separated list of accepted encodings, like: "br, gzip, deflate". "
Testing with the following
Using this method with the API I am testing with, it returns gzip data that needs to be decompressed manually. The only way to determine what type of compression (if any) is returned is by passing in verbose as true with ofHTTPRequest.
When testing with the following:
All of the supported compressions are added and curl decompresses the data so that it can be used.
Is there a reason not to use "
curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, "");" ?