From ce3f545db83dd09dfee42647a747e2ff4c4d7863 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 13 Jan 2008 15:27:49 +0000 Subject: Fixed getBaseUrl. --- framework/Web/THttpRequest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } /** -- cgit v1.2.3