-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect headers parsing #5838
Comments
Send the request with headers
And use the Notice this line.
From the ASCII table:
It seems that the server doen't handle
Reference: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4 Test through aiohttp's vendor lib
|
In RFC 2616:
However, this RFC has been obsoleted by RFC 7230 which forbids folding:
Reference: https://datatracker.ietf.org/doc/html/rfc7230#section-8.3.1
But I suggest that it is better to use base64 encoding. |
So, should the client side code be raising an error or encoding the headers in this situation? |
If check the characters in HTTP request header, it will have an impact on performance. Maybe it should be mentioned in the doc which characters should not be included in header and tell the user how to encode. |
I think this is exactly what dev mode is for: We can just enable the extra checks when run with |
Duplicate of #4818 |
Describe the bug
Faced with issue that if there is newline symbol (
\n
) in headersaiohttp
drops other headers in GET request. Seems like should be validation for custom headers when sending request.For websocket connection this bug leads to handshake error
WSServerHandshakeError
.it's also possible to send extra data after new line which could be parsed by server as extra headers:
this bug starts reproducing from
aiohttp==3.6.3; yarl==1.5.1; multidict==4.7.6
and could be reproduced with latest aiohtp versioneverything works as expected with
aiohttp==3.6.2
To Reproduce
\n
charactersExpected behavior
Do not drop headers after
\n
characters. That should be parsed as"CustomHerder": "somebrokenstr"
like it was so in 3.6.2 versionOr raise validation error or warning message that tells about incorrect characters in headers or filter out such characters on client side
Logs/tracebacks
client
server
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Ubuntu 20.04.2 LTS
Related component
Server, Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: