Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Closed

Conversation

@tiraeth
Copy link

QA
Bug fix?yes
New feature?no
BC breaks?yes
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Currently, BrowserKit operates incorrectly. It follows "redirect" whenLocation header is present, but having just the header is not enough to perform redirection.RFC-2616 precisely says that the redirection should be performed only with30x status 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 returningLocation header withHTTP 201/Created status code and was surprised that BrowserKit follows the redirection.

This PR is for 2.3 version (master) of Symfony.

@fabpot
Copy link
Member

This is definitely "just" a bug. So, we need to fix it in 2.1 (no need to create PRs for other branches).
You need to remove the new argument forfollowRedirect() as we should not provide workarounds for misbehaving apps.

Copy link
Member

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

Copy link
Contributor

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

Copy link
Author

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.

Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Done.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@tiraeth@fabpot@staabm@stof

[8]ページ先頭

©2009-2025 Movatter.jp