Closed Trott closed 12 years ago
This is resolved in config already:
if (isset($_SERVER['HTTP_HOST'])) {
define('MWF_CONFIG_SITE_URL', $scheme . '://' . $_SERVER['HTTP_HOST']);
} else {
if (isset($_SERVER['SERVER_NAME'])) {
if (isset($_SERVER['SERVER_PORT'])) {
$port = $_SERVER['SERVER_PORT'] == getservbyname($scheme, "tcp") ? '' : ':' . $_SERVER['SERVER_PORT'];
}
define('MWF_CONFIG_SITE_URL', $scheme . '://' . $_SERVER['SERVER_NAME'] . $port);
} else {
// no SERVER_NAME, must be command-line testing
define('MWF_CONFIG_SITE_URL', 'http://localhost');
}
}
This is handled similarly in js/appicon.php
:
if(isset($_SERVER['HTTP_X_FORWARDED_SERVER']))
$appicon_img = '//'.$_SERVER['HTTP_X_FORWARDED_SERVER'].'/'.$appicon_img;
elseif(isset($_SERVER['HTTP_HOST']))
$appicon_img = '//'.$_SERVER['HTTP_HOST'].'/'.$appicon_img;
elseif(substr($appicon_img, 0, 1) != '/')
$appicon_img = '/'.$appicon_img;
Similarly this is also handled in lib/js_vars_helper.class.php
:
if (isset($_SERVER['HTTP_HOST'])) { // actual host for multi-host requests
self::$_cookie_domain = $_SERVER['HTTP_HOST'];
} else { // fallthru that will not support successful multi-host requests
self::$_cookie_domain = Config::get('global', 'site_assets_url');
if (($pos = strpos(self::$_cookie_domain, '//')) !== false)
self::$_cookie_domain = substr(self::$_cookie_domain, $pos + 2);
if (($pos = strpos(self::$_cookie_domain, '/')) !== false)
self::$_cookie_domain = substr(self::$_cookie_domain, 0, $pos);
}
HTTP_HOST is not required in HTML/1.0. Config object assumes it is set. Should grep through other code for usages of HTTP_HOST that don't account for its possible absence.