aio-libs / aio-libs/aiohttp

Quality values not considered when parsing Accept-Encoding request header

未关闭
#4,726 1 条评论 0 个 reaction 已指派 1 人 已被 @steverep 认领 在 GitHub 查看
enhancement
主要语言
Python
星标
16.5k
派生
2.4k
平均合并
17 小时 22 分钟
30 天内合并 PR
212

描述

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?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。