-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
gh-70765: avoid waiting for HTTP headers when parsing HTTP/0.9 requests #139514
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
Conversation
74a818a to
048ee83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
|
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…requests (pythonGH-139514) (cherry picked from commit 13dc2fd) Co-authored-by: Bénédikt Tran <[email protected]>
|
Sorry, @picnixz, I could not cleanly backport this to |
|
GH-139600 is a backport of this pull request to the 3.14 branch. |
…TP/0.9 requests (pythonGH-139514) (cherry picked from commit 13dc2fd) Co-authored-by: Bénédikt Tran <[email protected]>
|
GH-139602 is a backport of this pull request to the 3.13 branch. |
|
Ok, so I think something happens here where the connection is still closed on macOS. On Linux or in the CI I didn't have any issue but it appears that we could have a reset by peer error on macOS: https://github.com/python/cpython/actions/runs/18260872622/job/51988587155?pr=139607. I don't know why, but I guess it's something I didn't think of. I'll move to my dev session again to fix this. |
Fix a flaky test introduced in 13dc2fd. After a single HTTP/0.9 request, both client and server are expected to close the connection on their side. In particular, if a client sends two requests with the same connection, only the first one should be handled. In the tests, it might happen that checking for the second request to be ignored did not take into account that the server may have already closed the connection. This flaky behavior was first observed on macOS CI workers but could not be reproduced locally on a Linux machine.
…requests (pythonGH-139514) (cherry picked from commit 13dc2fd) (cherry picked from commit 1fe89d3) Co-authored-by: Bénédikt Tran <[email protected]>
…TP/0.9 requests (pythonGH-139514) (cherry picked from commit 13dc2fd) (cherry picked from commit 1fe89d3) Co-authored-by: Bénédikt Tran <[email protected]>
…TP/0.9 requests (pythonGH-139514) (cherry picked from commit 13dc2fd) (cherry picked from commit 1fe89d3) Co-authored-by: Bénédikt Tran <[email protected]>
…TP/0.9 requests (pythonGH-139514) (cherry picked from commit 13dc2fd) (cherry picked from commit 1fe89d3) Co-authored-by: Bénédikt Tran <[email protected]>
…TP/0.9 requests (pythonGH-139514) (cherry picked from commit 13dc2fd) (cherry picked from commit 1fe89d3) Co-authored-by: Bénédikt Tran <[email protected]>
|
Getting ECONNRESET when sending to a TCP socket when the remote end has shut down is probably a normal behaviour. The remote end might reply with a TCP reset packet. I don't have experience with Mac OS or BSD but perhaps it could receive that reset packet synchronously and reports it as an error from the send call. (On the other hand, I think Linux receives it asynchronously after send to localhost has returned.) |
…on#139610) Fix a flaky test introduced in 13dc2fd. After a single HTTP/0.9 request, both client and server are expected to close the connection on their side. In particular, if a client sends two requests with the same connection, only the first one should be handled. In the tests, it might happen that checking for the second request to be ignored did not take into account that the server may have already closed the connection. This flaky behavior was first observed on macOS CI workers but could not be reproduced locally on a Linux machine.
… requests (GH-139514) (#139600) (cherry picked from commit 13dc2fd) (cherry picked from commit 1fe89d3) Co-authored-by: Bénédikt Tran <[email protected]>
@Carmina16 with this patch, the handler should be correct. The tests did not catch this regression because we use a shortcut for sending requests and
parse_requestis never called because of that.