Reputation: 39349
Using both httpbin and Postman Echo (which appear to be the same service, effectively), I'm able to successfully get a gzip'd response with their testing endpoint like this:
var cli = new HttpClient(new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip
});
await cli.GetAsync("https://postman-echo.com/gzip");
But if I do the equivalent with their deflate testing endpoint:
var cli = new HttpClient(new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.Deflate
});
await cli.GetAsync("https://postman-echo.com/deflate");
I get the following exception/inner exceptions, thrown from System.Net.Http.HttpContent.LoadIntoBufferAsync
:
----> System.Net.Http.HttpRequestException : Error while copying content to a stream.
----> System.IO.IOException : The read operation failed, see inner exception.
----> System.Net.Http.WinHttpException : Operation aborted
I can repro in both .NET Core and .NET Framework. Note that these both work fine in a browser:
https://postman-echo.com/deflate
It's tempting to think this is a bug with the testing service, but since browsers handle it fine, as do libraries on other platforms (their test suite is extensive, but they're not .NET guys), I'm really not sure which way to point the finger. What exactly is that exception telling me?
Upvotes: 5
Views: 7351