Repository navigation
http: re-check pending data before flushing on reused sockets - #67606
Open
ShogunPanda wants to merge 1 commit into
Open
ShogunPanda wants to merge 1 commit into
ShogunPanda wants to merge 1 commit into
Conversation
Re-check a reused socket for unread data immediately before the request is flushed, since data can arrive between the Agent's selection of the socket and the next tick. Also probe Windows named pipes with PeekNamedPipe() so they are covered like on POSIX. Assisted-By: OpenAI:GPT-5.6 Sol <openai/gpt-5.6-sol> Signed-off-by: Paolo Insogna <paolo@cowtech.it>
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67606 +/- ##
==========================================
- Coverage 90.73% 90.72% -0.01%
==========================================
Files 801 801
Lines 280794 280812 +18
Branches 54202 54211 +9
==========================================
- Hits 254771 254767 -4
- Misses 16202 16206 +4
- Partials 9821 9839 +18
🚀 New features to boost your workflow:
|
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an HTTP agent reuses a kept-alive socket, the request is flushed on a later tick than the one on which the socket was selected, and nothing re-checked the socket for unread data in between. Data arriving in that window could be read as the response to the new request.
This re-checks the reused socket for pending data immediately before the request is flushed: if there is any, the request fails with
ECONNRESETinstead of being sent on that socket. It also makes the pending-read probe cover Windows named pipes, usingPeekNamedPipe(), as it already does on POSIX.Adds regression tests for the pre-flush window, for reuse of a free socket that received unsolicited data, and for the pipe probe.
AI-assisted work. All changes reviewed by a human.