aio-libs / aio-libs/aiohttp

Quality values not considered when parsing Accept-Encoding request header

Aperta
#4,726 1 commento 0 reazioni 1 assegnatario Rivendicata da @steverep Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
16.5k
Fork
2.4k
Merge medio
17h 22m
PR unite (30g)
212

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.