diff options
author | xue <> | 2008-01-13 15:27:49 +0000 |
---|---|---|
committer | xue <> | 2008-01-13 15:27:49 +0000 |
commit | ce3f545db83dd09dfee42647a747e2ff4c4d7863 (patch) | |
tree | 22336929ed33391117f3fde4a3f13c094ce3bbd0 | |
parent | 10ba6d05b807d3a4a01408a4085455976d4ac89b (diff) |
Fixed getBaseUrl.
-rw-r--r-- | framework/Web/THttpRequest.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index ca7780cd..aec71262 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -358,7 +358,12 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar */ public function getBaseUrl($forceSecureConnection=false) { - return ($this->getIsSecureConnection() || $forceSecureConnection ? "https://" : "http://") . $_SERVER ['HTTP_HOST']; + $secure=$this->getIsSecureConnection() || $forceSecureConnection; + $url=($secure ? "https://" : "http://") . $_SERVER ['HTTP_HOST']; + $port=$_SERVER['SERVER_PORT']; + if(($port!=80 && !$secure) || ($port!=443 && $secure)) + $url.=':'.$port; + return $url; } /** |