diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-01 15:08:08 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-07-01 15:08:08 -0700 |
commit | fbdf46b76e0162261be4a7c9e5a71868a331f4d8 (patch) | |
tree | d7b3216b43636effbbd6a1c32f4a296b4c38c296 | |
parent | c7770265063045a8de69f4171236ffe33a22c87e (diff) | |
parent | 7d7a2ce31725518084e09ae32bc74533732909ba (diff) | |
download | nextcloud-server-fbdf46b76e0162261be4a7c9e5a71868a331f4d8.tar.gz nextcloud-server-fbdf46b76e0162261be4a7c9e5a71868a331f4d8.zip |
Merge pull request #3748 from owncloud/fixing-3740-master
in case $_SERVER['HTTP_HOST']) is not set let's return localhost - bette...
-rwxr-xr-x | lib/request.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/request.php b/lib/request.php index 4d8380eb9ac..df33217f95d 100755 --- a/lib/request.php +++ b/lib/request.php @@ -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', '') . '/'; @@ -19,7 +19,7 @@ class OC_Request { /** * @brief Returns the server host - * @returns the server host + * @returns string the server host * * Returns the server host, even if the website uses one or more * reverse proxies @@ -40,7 +40,13 @@ class OC_Request { } } else{ - $host = $_SERVER['HTTP_HOST']; + if (isset($_SERVER['HTTP_HOST'])) { + return $_SERVER['HTTP_HOST']; + } + if (isset($_SERVER['SERVER_NAME'])) { + return $_SERVER['SERVER_NAME']; + } + return 'localhost'; } return $host; } @@ -48,7 +54,7 @@ class OC_Request { /** * @brief Returns the server protocol - * @returns the server protocol + * @returns string the server protocol * * Returns the server protocol. It respects reverse proxy servers and load balancers */ @@ -70,7 +76,7 @@ class OC_Request { /** * @brief Returns the request uri - * @returns the request uri + * @returns string the request uri * * Returns the request uri, even if the website uses one or more * reverse proxies @@ -85,7 +91,7 @@ class OC_Request { /** * @brief Returns the script name - * @returns the script name + * @returns string the script name * * Returns the script name, even if the website uses one or more * reverse proxies @@ -139,7 +145,7 @@ class OC_Request { /** * @brief Check if this is a no-cache request - * @returns true for no-cache + * @returns boolean true for no-cache */ static public function isNoCache() { if (!isset($_SERVER['HTTP_CACHE_CONTROL'])) { @@ -150,7 +156,7 @@ class OC_Request { /** * @brief Check if the requestor understands gzip - * @returns true for gzip encoding supported + * @returns boolean true for gzip encoding supported */ static public function acceptGZip() { if (!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { |