aio-libs / aio-libs/aiohttp

Quality values not considered when parsing Accept-Encoding request header

Ouverte
#4,726 1 commentaire 0 réactions 1 personne assignée Réclamée par @steverep Voir sur GitHub
enhancement
Langage dominant
Python
Étoiles
16.5k
Forks
2.4k
Merge moyen
17 h 22 min
PR mergées (30 j)
212

Description

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?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.