[release/6.0-rc1] Enable SocketHttpHandler to decompress zlib or deflate (#57940)
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Mon, 23 Aug 2021 19:57:39 +0000 (15:57 -0400)
committerGitHub <noreply@github.com>
Mon, 23 Aug 2021 19:57:39 +0000 (15:57 -0400)
commit030f56048074345764576802d8ec0afc27b62ecb
treed5ed7bc79d555cf7a594a355a51e4e2e754e6511
parent0ab239d53742fd806e7b62da2c1f3a0ca9bfc579
[release/6.0-rc1] Enable SocketHttpHandler to decompress zlib or deflate (#57940)

* Enable SocketHttpHandler to decompress zlib or deflate

Some servers incorrectly implement the deflate content-coding with the raw deflate algorithm rather than with deflate wrapped with a zlib header/footer.  Auto-detect whether to use ZLibStream or DeflateStream in order to accomodate both kinds of responses.

* Fix test build for WinHttpHandler on .NET Framework

* Apply suggestions from code review

* Add decompression test for empty response body

* Add decompression tests for multiple source content lengths

Co-authored-by: Stephen Toub <stoub@microsoft.com>
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Decompression.cs
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.RemoteServer.cs
src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTestBase.cs
src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/DecompressionHandler.cs