libcpr / cpr

C++ Requests: Curl for People, a spiritual port of Python Requests.
https://docs.libcpr.org/
Other
6.49k stars 924 forks source link

acceptEncoding must provide a way to disable content-encoding #925

Closed obelixzgz closed 1 year ago

obelixzgz commented 1 year ago

Is your feature request related to a problem?

The original curl option CURLOPT_ACCEPT_ENCODING let disabling the content-encoding functionality when you pass NULL as the parameter, instead of using the empty string (which means enable the functionality and accept all known encodings). The actual implementation in cpr let us choose the encoding but not disabling the functionality.

It is necessary due to some old servers incorrectly returning "Content-Enconding: UTF-8" making interoperability impossible.

Possible Solution

Add a new encoding method "none", that makes

curl_easysetopt(curl->handle, CURLOPT_ACCEPT_ENCODING, null);

in cpr/session.cpp

Alternatives

No response

Additional Context

No response

COM8 commented 1 year ago

@obelixzgz Thanks for your feature request! I created a PR for it here: https://github.com/libcpr/cpr/pull/926 Could you please try if this one fulfils your needs?