use $_SERVER['SERVER_NAME'] in case $_SERVER['HTTP_HOST'] is not set

This commit is contained in:
Thomas Müller 2013-07-01 23:51:43 +02:00
parent 383e4c62b5
commit 7d7a2ce317
1 changed files with 8 additions and 2 deletions

View File

@ -9,7 +9,7 @@
class OC_Request {
/**
* @brief Check overwrite condition
* @returns true/false
* @returns bool
*/
private static function isOverwriteCondition($type = '') {
$regex = '/' . OC_Config::getValue('overwritecondaddr', '') . '/';
@ -40,7 +40,13 @@ class OC_Request {
}
}
else{
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
if (isset($_SERVER['HTTP_HOST'])) {
return $_SERVER['HTTP_HOST'];
}
if (isset($_SERVER['SERVER_NAME'])) {
return $_SERVER['SERVER_NAME'];
}
return 'localhost';
}
return $host;
}