Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[BrowserKit] should not follow redirects if status code is not 30x#8025
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fabpot commentedMay 13, 2013
This is definitely "just" a bug. So, we need to fix it in 2.1 (no need to create PRs for other branches). |
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.
you should get it only when the status code allows it to avoid useless work
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 not 30X but 3XX
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.
HTTP spec says3xx Redirection but available codes are30x only and it's a common way of calling redirection status codes - 30x. The conditional, by the way, is a copy-paste from Guzzle.
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.
Then maybe the upgrade note should be adjusted?
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.
Done.
Currently, BrowserKit operates incorrectly. It follows "redirect" when
Locationheader is present, but having just the header is not enough to perform redirection.RFC-2616 precisely says that the redirection should be performed only with30xstatus codes.This PR fixes the incorrect behaviour of BrowserKit and make it consist with both the RFC document and with other clients, used for example with Behat.
I've found the issue while testing my application with Behat. I was returning
Locationheader withHTTP 201/Createdstatus code and was surprised that BrowserKit follows the redirection.This PR is for 2.3 version (master) of Symfony.