-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HttpClient gzip #112042
Comments
Tagging subscribers to this area: @dotnet/ncl |
No real surprise there, as you commented this line out. Pay attention to the documentation for the
Essentially, the default value for |
Well, the server sends a header indicating that the content is encoded, so normally, the client should decode it. Yes, for the GetAsync method, this is not mandatory, but for the GetStringAsync method, which returns text, it would be preferable to do so, as otherwise, the client would not be working correctly. |
And the server could theoretically send a compressed version even if it's not specified that the client supports it in the Accept-Encoding header. |
Normally, HttpClient should behave as documented. Ignore the documentation at your own peril. |
I don't like that in this case the code works validly, as if nothing happened, but in reality, it works invalidly. Instead of normal text, it produces a bunch of gibberish. The client should probably throw an error or something like that because it processed invalidly and is ignoring it. |
Description
HttpClient does not unpack gzip data from the HTTP response, even though the server includes the Content-Encoding: gzip header.
The GetStringAsync method does not work correctly in this context.
https://github.com/Mr0N/TestHttpClient/blob/master/TestHttpClient/Program.cs
Reproduction Steps
Expected behavior
Actual behavior
Regression?
Known Workarounds
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: