Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Routing] Allow GET requests to be redirected. Fixes #23004 #23009

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

Merged
merged 1 commit into from
Jun 1, 2017
Merged

[Routing] Allow GET requests to be redirected. Fixes #23004 #23009

merged 1 commit into from
Jun 1, 2017

Conversation

frankdejonge
Copy link
Contributor

Q A
Branch? 3.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #23004
License MIT
Doc PR NA

GET requests didn't get the same redirect treatment as HEAD requests. I've also added tests cases for all the different trailing/non-trailing slash situations.

@frankdejonge
Copy link
Contributor Author

In the current implementation I saw that redirects behaviour is still rather naive. For example, when a route is registered with with POST and GET as available methods and there's a trailing slash the dumped matcher will try to redirect it, which I think it shouldn't. We have a number of options to resolve this:

  1. Not redirect requests where the canonical method != GET. In this case the route would match.
  2. Separate match check based on wether the route is redirectable (by RFC)
  3. Keep current behaviour.

@weaverryan
Copy link
Member

In the current implementation I saw that redirects behaviour is still rather naive.

By "current implementation", do you mean 3.2 and before?

It looks like this PR fixes the behavior change from 3.2 to 3.3 (correct?). Should we discuss the proper/better behavior on a different issue to keep this one moving?

Thanks for the fast PR btw!

@weaverryan weaverryan added this to the 3.3 milestone Jun 1, 2017
@frankdejonge
Copy link
Contributor Author

frankdejonge commented Jun 1, 2017

@weaverryan ah yeah sorry about this, should have been more specific. But yeah, it's also 3.2 and before. I'll open a new issue for the redirect behaviour.

@dubaksk
Copy link

dubaksk commented Jun 1, 2017

@weaverryan We were upgrading from 3.2.9 to 3.3.0 and also we have another project running on 3.2.8 which is also redirecting.

@frankdejonge
Copy link
Contributor Author

frankdejonge commented Jun 1, 2017

I think this was a side-effect of introducing the canonical method btw. There was some not super well defined handling going on there. With the PR it was (accidentally) made clearer, but this one seemed to have slipped through.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

fabpot commented Jun 1, 2017

Thank you @frankdejonge.

@fabpot fabpot merged commit 71d4e36 into symfony:3.3 Jun 1, 2017
fabpot added a commit that referenced this pull request Jun 1, 2017
…(frankdejonge)

This PR was merged into the 3.3 branch.

Discussion
----------

[Routing] Allow GET requests to be redirected. Fixes #23004

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23004
| License       | MIT
| Doc PR        | NA

GET requests didn't get the same redirect treatment as HEAD requests. I've also added tests cases for all the different trailing/non-trailing slash situations.

Commits
-------

71d4e36 [Routing] Allow GET requests to be redirected. Fixes #23004
@frankdejonge frankdejonge deleted the bugfix/php-matcher-dumper-redirects branch June 1, 2017 19:30
@fabpot fabpot mentioned this pull request Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants