Client support for compressed transfer encoding
- Ngôn ngữ chính
- Python
- Star
- 16.5k
- Fork
- 2.4k
- Merge trung bình
- 17 giờ 22 phút
- Pull request đã merge (30 ngày)
- 212
Mô tả
## Long story short
aiohttp does not support any transfer encoding other than chunking. Responses from servers using e.g. `Transfer-Encoding: gzip` result in the compressed payload. Worse yet, those applying both compression and chunking result in the raw payload with chunking still intact (but only when using the C parser!).
## Expected behaviour
Decompressed payload.
## Actual behaviour
Compressed or compressed + chunked payload.
## Steps to reproduce
A simple server and client illustrating this issue can be found in [this gist](https://gist.github.com/JustAnotherArchivist/ba23cb434810254a7d55ec893e45e1d4). I wrote a single test client and server for both this issue and #4436; the first line is irrelevant to this issue and not included in the output below.
Expected output:
```
> python3 client.py | tail -n+2
b'Test'
b'Test'
```
Actual output:
```
> python3 client.py | tail -n+2
b'\x1f\x8b\x08\x00\x82Y\xf0]\x02\xff\x0bI-.\x01\x002\xd1Mx\x04\x00\x00\x00'
b'5\r\n\x1f\x8b\x08\x00\x82\r\n13\r\nY\xf0]\x02\xff\x0bI-.\x01\x002\xd1Mx\x04\x00\x00\x00\r\n0\r\n\r\n'
```
However, when running it with the pure-Python parser, the chunked TE gets handled in the second case, and the output is:
```
> AIOHTTP_NO_EXTENSIONS=1 python3 client.py | tail -n+2
b'\x1f\x8b\x08\x00|\\\xf0]\x02\xff\x0bI-.\x01\x002\xd1Mx\x04\x00\x00\x00'
b'\x1f\x8b\x08\x00|\\\xf0]\x02\xff\x0bI-.\x01\x002\xd1Mx\x04\x00\x00\x00'
```
## Your environment
I tested this with aiohttp 2.3.10 and Python 3.6.9 on Debian, but based on the current aiohttp code, the behaviour should still be the same on the current versions.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.