diff options
| author | Rogdham <3994389+Rogdham@users.noreply.github.com> | 2023-05-14 17:36:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-14 10:36:00 -0500 |
| commit | aca0f01bb6a29eda24799ec31895f45a1bb9e58b (patch) | |
| tree | 229f194df82da9867f34f2edf9bb962582afdea3 /test | |
| parent | be5e03b940c301f057e45b22ce5a7022071a3361 (diff) | |
| download | urllib3-aca0f01bb6a29eda24799ec31895f45a1bb9e58b.tar.gz | |
Fix multi-frame Zstandard response decoding
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_response.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_response.py b/test/test_response.py index 6b5b1a17..c6d9d152 100644 --- a/test/test_response.py +++ b/test/test_response.py @@ -333,6 +333,25 @@ class TestResponse: assert r.data == b"foo" @onlyZstd() + def test_decode_multiframe_zstd(self) -> None: + data = ( + # Zstandard frame + zstd.compress(b"foo") + # skippable frame (must be ignored) + + bytes.fromhex( + "50 2A 4D 18" # Magic_Number (little-endian) + "07 00 00 00" # Frame_Size (little-endian) + "00 00 00 00 00 00 00" # User_Data + ) + # Zstandard frame + + zstd.compress(b"bar") + ) + + fp = BytesIO(data) + r = HTTPResponse(fp, headers={"content-encoding": "zstd"}) + assert r.data == b"foobar" + + @onlyZstd() def test_chunked_decoding_zstd(self) -> None: data = zstd.compress(b"foobarbaz") |
