aio-libs / aio-libs/aiohttp

Quality values not considered when parsing Accept-Encoding request header

Offen
#4,726 1 Kommentar 0 Reaktionen 1 zugewiesene Person Beansprucht von @steverep Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
16.5k
Forks
2.4k
Ø Merge
17 Std. 22 Min.
Gemergte PRs (30 T.)
212

Beschreibung

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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.