Repository navigation
Follow only 301, 302, 303, 307 and 308 redirects - #2646
Merged
Merged
Conversation
With follow_location, any 3xx from 301 to 399 that had a Location was followed, so a 304 Not Modified, a 305 Use Proxy or a 306 with a Location header made the client request that location and return its response instead. Only 301, 302, 303, 307 and 308 are redirections the client can follow (RFC 9110, section 15.4; the Fetch standard uses the same set); any other 3xx is now returned as the final response.
Owner
|
Thanks! |
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.
detail::is_redirecttreats any status from 301 to 399 that has aLocationas a redirect. Withset_follow_location(true), a 304 Not Modified, a 305 Use Proxy or a 306 that carries aLocationheader makes the client request that location and return its response instead. The comment above the function already says a 304 is a final response. A 304 has no new target, and 305 was deprecated "due to security concerns regarding in-band configuration of a proxy" (RFC 7231, Appendix B).The redirections RFC 9110 defines for a client to follow are 301, 302, 303, 307 and 308 (section 15.4). The Fetch standard's redirect statuses are the same set, and
detail::redirectonly special-cases 303.is_redirectnow accepts only these five statuses, and a Location is still required. 300 Multiple Choices wasn't followed before and still isn't.The new
RedirectTest.OtherStatusesWithLocationAreNotFollowedserves a 304 and a 305 withLocation: /targetand expects the client to return them without requesting/target. Without the change, both are followed and return 200. The redirect tests and the new test pass with the change (OpenSSL build, with g++), andgit clang-formatreports nothing for the change.