]> source.dussan.org Git - nextcloud-server.git/commitdiff
use $_SERVER['SERVER_NAME'] in case $_SERVER['HTTP_HOST'] is not set
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 1 Jul 2013 21:51:43 +0000 (23:51 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 2 Jul 2013 20:27:52 +0000 (22:27 +0200)
lib/request.php

index 2f94da13548c3ebea9db789d0c3f3f01b38a1fb1..24a118b8b40943adcb57d787a3e37b26f4fac147 100755 (executable)
@@ -9,7 +9,7 @@
 class OC_Request {
        /**
         * @brief Check overwrite condition
-        * @returns true/false
+        * @returns bool
         */
        private static function isOverwriteCondition() {
                $regex = '/' . OC_Config::getValue('overwritecondaddr', '')  . '/';
@@ -39,7 +39,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;
        }