Closed sergey-scat closed 11 months ago
@sergey-scat maybe this little article gives you some information about what is happening here and why is it happening: https://bogdanfinn.gitbook.io/open-source-oasis/tls-client/response-body-encoding-decoding
Also the article shows an example how to avoid that.
@bogdanfinn Oh, I see, thank you. I tried your example and it automatically decompressed gzip (as I now understand, because it was using HTTP2), so I thought the response was always decompressed according to the value of the Content-Encoding header.
So could you please tell me why there is no automatic decompression when using the HTTP1 protocol?
@bogdanfinn it was never implemented i think. The thing here is that i forked the fhttp package dependency and only adjusted the parts i needed for this tls client ... it was just implemented like it is back then and never touched.
Another way to think about encoding issues is that if the Content-Encoding header is present on a response object, it must be decoded manually.
@sergey-scat changed the behavior in version 1.4.0
Closed due to inactivity
In some cases (when the "Accept-Encoding" header is used) rubbish is returned in the response body instead of readable data.
Here is a Python example:
The script above returns the following:
And everything would work fine if you removed "accept-encoding" from the headers: