-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Routing] Add a '_host' requirement for routes #3002
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,12 @@ protected function matchCollection($pathinfo, RouteCollection $routes) | |
continue; | ||
} | ||
|
||
if ($hostreq = $route->getRequirement('_host')) { | ||
if ($hostreq !== $this->context->getHost()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not simply There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's neccessary to test whether the requirement is set at all. Your condition would reject every route that has no _host requirement defined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Wrotten to fast ;-) But it can be merged into one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that'd be ok :) |
||
continue; | ||
} | ||
} | ||
|
||
// check HTTP method requirement | ||
if ($req = $route->getRequirement('_method')) { | ||
// HEAD and GET are equivalent as per RFC | ||
|
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.
Missing space after
if