Repository navigation
HTTP inbound: Forward short 100 Continue responses promptly - #7298
Merged
Merged
Conversation
Avoid waiting beyond the status prefix before forwarding an interim response. A client waiting for Continue cannot send its body while the origin waits for that body. Add a regression that withholds the final response until the interim response is forwarded. Assisted-by: Codex Signed-off-by: Eljees <3.14hell@gmail.com>
Removed the TestReadResponseAndHandle100ContinueForwardsBeforeFinalResponse test and related responseReaderFunc type.
Updated the peek size for reading response in readResponseAndHandle100Continue function.
Member
|
@Fangliding 先执行 |
A fragmented first read can contain less than the status prefix. Wait for that prefix before the adaptive buffered peek, so a 100 Continue response is forwarded before parsing the final response. Exercise fragmentation in the existing response test. Assisted-by: Codex Signed-off-by: Eljees <3.14hell@gmail.com>
Member
|
先读一次再取出缓存中字节 应该不会有这个header都要拆开发的请求 |
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.
A minimal
100 Continueresponse must be forwarded before the client sends its body. Read the HTTP status prefix before inspecting the currently buffered response, then keep the adaptive peek of up to 56 buffered bytes. A partial first read containing onlyHmust not cause the interim response to be treated as the final response.The existing final-response test now reads its input one byte at a time. On the preceding implementation it returns status 100 instead of 200; with the minimum-prefix read it forwards Continue and returns the final response. The separate fixture removed during review remains removed.
Validation of the latest change:
./proxy/http ./proxy/socks ./common/protocol/http(11 leaf tests), plus seven HTTP scenarios selected by^Test(Http|HTTP)in./testing/scenarios, pass. Linux runs both scopes with-race; the upstream scenario helper builds ordinary child Xray binaries.git diff --checkpass.TestSudokuE2ETemp/hysteria2/prefer_asciiwith a Sudoku decode error. The HTTP tests passed in that run; this change does not claim to repair the Sudoku failure.AI-assisted implementation and tests, separately reviewed and checked against the reproduced behavior.