-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
feat: supports setting multiple hosts #2486
base: master
Are you sure you want to change the base?
Conversation
Well, the investigation revealed that httptools changed its behavior in 0.6.3. pip install --upgrade httptools==0.6.3 import httptools
REQUEST_AFTER_CONNECTION_CLOSE = b"\r\n".join(
[
b"GET / HTTP/1.1",
b"Host: example.org",
b"Connection: close",
b"",
b"",
b"GET / HTTP/1.1",
b"Host: example.org",
b"",
b"",
]
)
parser = httptools.HttpRequestParser("a")
# Adding this line works fine.
# parser.set_dangerous_leniencies(lenient_data_after_close=True)
print(parser.feed_data(REQUEST_AFTER_CONNECTION_CLOSE)) output: print(parser.feed_data(REQUEST_AFTER_CONNECTION_CLOSE))
File "httptools/parser/parser.pyx", line 259, in httptools.parser.parser.HttpParser.feed_data
httptools.parser.errors.HttpParserError: Data after `Connection: close` |
Is it a problem on uvicorn or on httptools? |
REQUEST_AFTER_CONNECTION_CLOSE = b"\r\n".join(
[
b"GET / HTTP/1.1",
b"Host: example.org",
b"Connection: close",
b"",
b"",
b"GET / HTTP/1.1",
b"Host: example.org",
b"",
b"",
]
) If such a message exists in a real environment, it's a problem with uvicorn. |
I don't understand. Is it because of a security issue that was fixed? |
Here are the details of this commit:
It looks like the error was passed to the caller, maybe it hadn't been before. I'm not a cython expert. |
Oh, I see, now using a more standardized and strict parsing method. That's why the above message, when processed, reported an error. After the connection is closed, no messages should be sent after it. |
So uvicorn should not send anything to the parser after, right? |
I don't know, I'd have to read some resources before answering that. |
We'll take the next step when we figure it out. |
Summary
On the realization of this discussion
#1529
Checklist