8000 [Routing] Add a '_host' requirement for routes by sebhoerl · Pull Request #3002 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Routing] CS fix and structure change
  • Loading branch information
sebhoerl committed Dec 30, 2011
commit a7ff989e33f0161e024f373b3232b6e2457ee334
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function dump(array $options = array())

$rule = array("# $name");

if($hostreq = $route->getRequirement('_host')) {
if ($hostreq = $route->getRequirement('_host')) {
$rule[] = "RewriteCond %{HTTP_HOST} $hostreq";
}

Expand Down
5 changes: 2 additions & 3 deletions src/Symfony/Component/Routing/Matcher/UrlMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ protected function matchCollection($pathinfo, RouteCollection $routes)
continue;
}

if ($hostreq = $route->getRequirement('_host')) {
if ($hostreq !== $this->context->getHost()) {
// check host requirement
if (($req = $route->getRequirement('_host')) && $req !== $this->context->getHost()) {
continue;
}
}

// check HTTP method requirement
Expand Down
0