Skip to content
Snippets Groups Projects
Commit 7eb5156f authored by Giovannoni Laurent's avatar Giovannoni Laurent
Browse files

fixes #295: URL::_buildCoreUrl() added the port number twice if it is nonstandard.

parent 704a3c22
No related branches found
No related tags found
No related merge requests found
......@@ -185,8 +185,12 @@ class Url
private static function _buildHost()
{
return array_key_exists('HTTP_X_FORWARDED_HOST', $_SERVER)
? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
if (array_key_exists('HTTP_X_FORWARDED_HOST', $_SERVER)) {
return $_SERVER['HTTP_X_FORWARDED_HOST'];
} else {
$hostParts = explode(':',$_SERVER['HTTP_HOST']);
return $hostParts[0];
}
}
private static function _buildPort()
......
......@@ -25,7 +25,7 @@ class UrlTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTPS'] = (strpos($url_parts[0], 's') !== false)
? 'on': '';
$host_parts = explode(':', $url_parts[2]);
$_SERVER['HTTP_HOST'] = $host_parts[0];
$_SERVER['HTTP_HOST'] = $url_parts[2];
if (count($host_parts) == 2) {
$_SERVER['SERVER_PORT'] = $host_parts[1];
} else {
......
......@@ -25,7 +25,7 @@ class UrlWithProxyTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTPS'] = (strpos($url_parts[0], 's') !== false)
? 'on': '';
$host_parts = explode(':', $url_parts[2]);
$_SERVER['HTTP_HOST'] = $host_parts[0];
$_SERVER['HTTP_HOST'] = $url_parts[2];
if (count($host_parts) == 2) {
$_SERVER['SERVER_PORT'] = $host_parts[1];
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment