Merge pull request #2852 from stojg/director-test-http-port

BUG: Director::test() don't respect port settings in $_FILE_TO_URL_MAPPING
This commit is contained in:
Sean Harvey 2014-02-17 13:55:53 +13:00
commit 3b9d49e32d

View File

@ -247,7 +247,13 @@ class Director implements TemplateGlobalProvider {
// Handle absolute URLs // Handle absolute URLs
if (@parse_url($url, PHP_URL_HOST) != '') { if (@parse_url($url, PHP_URL_HOST) != '') {
$bits = parse_url($url); $bits = parse_url($url);
$_SERVER['HTTP_HOST'] = $bits['host']; // If a port is mentioned in the absolute URL, be sure to add that into the
// HTTP host
if(isset($bits['port'])) {
$_SERVER['HTTP_HOST'] = $bits['host'].':'.$bits['port'];
} else {
$_SERVER['HTTP_HOST'] = $bits['host'];
}
$url = Director::makeRelative($url); $url = Director::makeRelative($url);
} }