-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
301 status code must drop request method to GET. #21514
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
I don't remember the reasons why 301 was not included back then. 👍 for changing this in master. ping @symfony/deciders |
@@ -507,6 +507,13 @@ public function testFollowRedirectWithPostMethod() | |||
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method'); | |||
$this->assertEquals($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method'); | |||
$this->assertEquals('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method'); | |||
|
|||
foreach (array(301, 302, 303) as $code) { |
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.
This should be part of a new test. No need to put it here.
👍 |
👍 but this should be documented in the upgrade files |
@jlamur Can you take the comments into accounts? Moving the new tests to a new method and adding a note in the CHANGELOG/UPGRADE files? |
@fabpot I didn't had enough time to do it, but it will be done this weekend. |
@jlamur If you don't have time, I'm sure someone can take over and finish it. |
[RFC 7231 §6.4.2](https://tools.ietf.org/html/rfc7231#section-6.4.2) states that 301 HTTP Code should forward POST requests to the Location URI. But, it also states that: > For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. This is the behavior implemented in almost all user agents. However the `BrowserKit` did forward the method to the subsequent request.
e16159b
to
abda966
Compare
@fabpot Please let me know if I did something wrong while updating UPGRADE/CHANGELOG files. |
Thank you @jlamur. |
This PR was merged into the 3.3-dev branch. Discussion ---------- 301 status code must drop request method to GET. | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | BC breaks? | yes | Tests pass? | yes | Fixed tickets | #20924 | License | MIT [RFC 7231 §6.4.2](https://tools.ietf.org/html/rfc7231#section-6.4.2) states that 301 HTTP Code should forward POST requests to the Location URI. But, it also states that: > For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. This is the behavior implemented in almost all user agents. However the `BrowserKit` did forward the method to the subsequent request. This PR make the `BrowserKit` change the request method from POST to GET when the response status code is 301. Commits ------- abda966 301 status code must drop request method to GET.
RFC 7231 §6.4.2 states that 301 HTTP Code should forward POST requests to the Location URI.
But, it also states that:
This is the behavior implemented in almost all user agents.
However the
BrowserKit
did forward the method to the subsequent request.This PR make the
BrowserKit
change the request method from POST to GET when the response status code is 301.