[Routing] host matching should be case-insensitive #9072

Closed
Tobion opened this Issue Sep 18, 2013 · 2 comments

Comments

Projects
None yet
3 participants
Member

Tobion commented Sep 18, 2013

The host subcomponent is case-insensitive.

http://tools.ietf.org/html/rfc3986#section-3.2.2

I don't think it is. Remember: The host check when generating urls is also affected.

fabpot added a commit that referenced this issue Oct 9, 2014

minor #12190 [Routing] fix type inconsistencies in RequestContext (To…
…bion)

This PR was merged into the 2.3 branch.

Discussion
----------

[Routing] fix type inconsistencies in RequestContext

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

Fixed inconsistencies in RequestContext:

- [x] port setters and getters inconsistent with constructor (string vs int)
- [x] host should be lowercased for easier case-insensitivity, see #9072
- [x] fix setQueryString with null
- [x] fix return phpdoc typehint

Commits
-------

676c4a0 [Routing] add tests for RequestContext
f61607f [Routing] fix inconsistencies in RequestContext
Contributor

thewilkybarkid commented Dec 13, 2014

This looks like it can be closed.

Member

Tobion commented Dec 13, 2014

Nope, still relevant.

fabpot added a commit that referenced this issue Feb 5, 2015

bug #13567 [Routing] make host matching case-insensitive (Tobion)
This PR was merged into the 2.3 branch.

Discussion
----------

[Routing] make host matching case-insensitive

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

Ignore case in host which means:
- When generating URLs we leave the case in the host as specified.
- When matching we always return lower-cased versions of parameters (because of https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Routing/RequestContext.php#L190 ) in the host. This is also what browers do. They lowercase the host before sending the request, i.e. WWW.eXample.org is sent as www.example.org. But when using curl for example it sends the host as-is. So the HttpFoundation Request class can actually have a non-lowercased host because it doesn't have this normalization.

Commits
-------

952388c [Routing] make host matching case-insensitive according to RFC 3986

@fabpot fabpot closed this Feb 5, 2015

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