Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
Tobion opened this Issue · 2 comments

3 participants

@Tobion
Collaborator

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 fabpot referenced this issue from a commit
@fabpot fabpot 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
4dad67e
@thewilkybarkid

This looks like it can be closed.

@Tobion
Collaborator

Nope, still relevant.

@fabpot fabpot referenced this issue from a commit
@fabpot fabpot 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
2e74341
@fabpot fabpot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.