-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Invalid header value char #7494
Comments
We have a fix for the error output (though I hadn't seen a bytearray before), but it's probably ending the line with |
Actually, I can't get your actual response to parse, regardless of the lenient settings I enable... If I allow lenient CRLF handling, then I still get:
So, it still trips up after the headers. If possible, I'd suggest getting the server fixed to use |
For the no extensions version, I think it may be similar, as the reason should be Probably, the server closed the connection because it has sent the full response, but the parser still thinks it's reading the HTTP status line and is waiting for the rest of the response. |
Actually, llhttp is fixing it: nodejs/llhttp#236 |
Thanks for taking care of this, IMHO making the parser stricter will yield in lots of reports like this. |
It's been made stricter due to security vulnerabilities. But, for the client side, we can allow some of the lenient options. We will still be enabling strict parsing when using dev mode ( |
Thanks. I'll close this when I find the parsing handling the line breaks gracefully |
Currently, 9.0.1 works if I use |
I believe I have the same issue, I am doing requests to a domotic device implemented in a cgi by the manufacturer, I can get the response properly while using requests library but while using aiohttp it fails with the message:
I guess this is likely related with message not being entire well formed? Is there any workaround I can put in place? |
This might give some hints, I believe it's because of a new line in the headers string?
|
That's not the same, and I can't tell exactly from your output, but maybe because the server is erroneously using \n instead of \r\n. Possibly related to: nodejs/llhttp#241 |
Sorry, mixing it up with another issue. That is the same issue, if that is the case. But, your output doesn't show the bytes, so I can't tell if it is using \r\n or just \n. |
from the error message of the aiohttp exception above I believe it adds \n and empty strings after it. |
I tried to downgrade the module version and test, it doesn't work |
We didn't touch the parser in 3.8.4: v3.8.3...v3.8.4 |
That is odd, it doesn't work with |
Maybe if it works with |
Same error here on win10. Downgrade to |
This should be fine in master now, should have a new release shortly. |
These kind of messages should parse now in 3.8.6. If you use Python dev mode though, it will go back to strict parsing, to help discover bugs in servers. |
Thanks for the heads up, I've found this while coding for a tiny scrapper which runs inside Home Assistant, they bumped to 3.8.6 already but now they are beta-testing 3.9, anyway I won't be checking this until they release it which will be first Wednesday of November. |
Tested this today on desktop, works great with 3.8.6. Thank you |
Describe the bug
I had a script doing some scrapping from a cablemodem, the web server is dodgy but used to work, it started failing now
To Reproduce
You won't be able to reproduce as this is my own cablemodem, I'm providing the capture data below.
Expected behavior
Parse the response somehow
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Windows 11
Related component
Client
Additional context
I'm not sure what the issue really is, the only odd thing to me is cablemodem answering HTTP/1.0 I don't know if this is to be expected.
Here is the request / response captured with Wireshark
looking for issues here, I found that this might be fixed by adding:
AIOHTTP_NO_EXTENSIONS=1
in that case exception changes to:
This might actually be another issue? For a quick research I found HTTP/1.0 will always close the connection after sending the response so ServerDisconnectedError should be "expected"?
Code of Conduct
The text was updated successfully, but these errors were encountered: