You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I may have found a bug in aiohttp's parsing of HTTP requests with duplicate chunked Transfer-Encoding.
RFC 9112 says these:
A sender MUST NOT apply the chunked transfer coding more than once to a message body (i.e., chunking an already chunked message is not allowed).
A server that receives a request message with a transfer coding it does not understand SHOULD respond with 501 (Not Implemented).
Although the RFC only restricts the sender (A sender MUST NOT apply the chunked transfer coding more than once to a message body), this should imply that duplicate chunked Transfer-Encoding is incorrect. The server may reject the request with 501 (Not Implemented) or 400 (Bad Request).
However, aiohttp does not reject such request.
A server that receives a request message with a transfer coding it does not understand SHOULD respond with 501 (Not Implemented).
We do understand the chunked coding, so this is not relevant.
I believe expected behaviour is either:
We parse it as chunked once and pop one of the chunked codes from the header (which is close to what happens right now).
We parse it as chunked twice and produce a parse error.
It probably makes sense to end up with a parse error in this context, so feel free to create a PR to change that, but I feel this is unlikely to get prioritised by a maintainer as the current approach is still a valid approach.
Describe the bug
Hello, I may have found a bug in aiohttp's parsing of HTTP requests with duplicate chunked
Transfer-Encoding
.RFC 9112 says these:
Although the RFC only restricts the sender (A sender MUST NOT apply the chunked transfer coding more than once to a message body), this should imply that duplicate chunked
Transfer-Encoding
is incorrect. The server may reject the request with501 (Not Implemented)
or400 (Bad Request)
.However, aiohttp does not reject such request.
To Reproduce
Expected behavior
The server may reject the request with
501 (Not Implemented)
or400 (Bad Request)
.Logs/tracebacks
Python Version
aiohttp Version
multidict Version
propcache Version
yarl Version
OS
Ubuntu 11.4.0-1ubuntu1~22.04
Related component
Server
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: