aio-libs / aio-libs/aiohttp

Quality values not considered when parsing Accept-Encoding request header

Đang mở
#4,726 1 bình luận 0 reaction 1 người được giao Được @steverep nhận Xem trên GitHub
enhancement
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ả

Quality values are not taken into consideration when parsing the `Accept-Encoding` request header field. The encoding chosen depends on the ordering in the `ContentCoding` enum:

https://github.com/aio-libs/aiohttp/blob/cd5c48a619ba61bff48ac1f30be7845f1506896f/aiohttp/web_response.py#L51-L58

and

https://github.com/aio-libs/aiohttp/blob/cd5c48a619ba61bff48ac1f30be7845f1506896f/aiohttp/web_response.py#L333-L338

However, [RFC 7231, section 5.4.3](https://tools.ietf.org/html/rfc7231#section-5.3.4) states
```
4. If multiple content-codings are acceptable, then the acceptable
content-coding with the highest non-zero qvalue is preferred.
```
Though, within a note RFC 7231 also mentions that

```
Note: Most HTTP/1.0 applications do not recognize or obey qvalues
associated with content-codings. This means that qvalues might
not work and are not permitted with x-gzip or x-compress.
```

Actually I'm not sure if this issue is a bug or rather a feature request. Though, I think that it would be a reasonable improvement. Would you accept a PR?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.