浏览代码

[HttpFoundation] simplified code

Fabien Potencier 14 年之前
父节点
当前提交
c19d6c07d2
共有 1 个文件被更改,包括 2 次插入6 次删除
  1. 2 6
      src/Symfony/Component/HttpFoundation/Request.php

+ 2 - 6
src/Symfony/Component/HttpFoundation/Request.php

@@ -489,17 +489,13 @@ class Request
     public function getHttpHost()
     {
         $scheme = $this->getScheme();
-        $host   = $this->getHost();
-        if (!$host) {
-            $host = $this->server->get('SERVER_NAME');
-        }
         $port   = $this->getPort();
 
         if (('http' == $scheme && $port == 80) || ('https' == $scheme && $port == 443)) {
-            return $host;
+            return $this->getHost();
         }
 
-        return $host.':'.$port;
+        return $this->getHost().':'.$port;
     }
 
     /**