Repository navigation
Conversation
decode_path_component turned %2F and %3F into real delimiters, so the follow-up request-target was a different URI from the one the redirect named. Co-authored-by: Cursor <cursoragent@cursor.com>
yhirose
added a commit
that referenced
this pull request
Oct 3, 2026
…#2607) A 303 response turns the follow-up request into a GET, but only the buffered body and headers were cleared. A content provider (sized or chunked) stayed on the request, so the original payload was sent again, and for a chunked provider the unframed chunks also broke the keep-alive connection. The redirect also percent-decoded the Location path before sending it. That turned %23, %3F and %25 into a fragment, a query delimiter and a different octet, so the client requested a different resource than the one named, and made set_path_encode(false) fail on any Location containing %20. The path is now sent as given.
Owner
|
Thanks for finding this. The bug is real, and an equivalent fix is in master as 09fa682. The test there also covers |
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.
Summary
ClientImpl::redirectrandecode_path_componenton theLocationpath before sending the next request.%XX, including reserved characters.%2Fbecame a path separator and%3Fbecame a query delimiter, so the client requested a different URI from the one named inLocation(RFC 3986 sections 2.2 and 6.2.2.2).encode_request_targetstill encodes raw controls when path encoding is on, andwrite_request_linestill rejects them when it is off.Test plan
Location: /a%2Fbis requested as/a%2Fb, andLocation: /x%3Fyis requested as/x%3Fywith no query parameteryRedirectLocationTest.PreservesEncodedSlashAndQuestionPostMethod303Redirectand the relative-location cases) still pass