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
httptools.parser.errors.HttpParserInvalidURLError on fragmented first line of the HTTP request. #1262
Comments
thanks for the detailed report ! I'm not sure there's much we can do about it, so unless upstream (http-parser) can deal with tcp fragmentation in url (which I doubt since it's been a while it's unmaintained) or happy to reopen in case things change or if these thoughts are incorrect @div1001 |
reopening I have a fix in mind |
this might be a good first approach from here: https://github.com/encode/uvicorn/pull/778/files, want to takle it @div1001 ? there might be side effect from this PR but I think that might solve your fragmentation issue |
I've understood your solution idea. |
sure ! take #1263 if you want as a baseline, I did that quickly so I'm not sure there are no edge cases, would be good to add tests for that : in the protocols module that should be the best, not sure how to handle the fragmentation in a test though but in that module we deal with several bare http requests so that would be a good place to add your snippet adapted for our tests format. |
Checklist
master
.Describe the bug
I've ran into issue with uvicorn+httptools, HttpParserInvalidURLError is raised and the server closes connection when the first line of the http/1.* request is split into several tcp packets.
It also seems like everything is fine if h11 used instead of httptools.
To reproduce
Expected behavior
HTTP response:
Actual behavior
Server closes connection without a response.
Environment
Running uvicorn 0.15.0 with CPython 3.8.2 on Linux
Dependencies:
uvicorn==0.15.0
h11==0.12.0
httptools==0.3.0
The text was updated successfully, but these errors were encountered: