summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgodzilla80@gmx.net <>2010-05-18 07:26:14 +0000
committergodzilla80@gmx.net <>2010-05-18 07:26:14 +0000
commiteaf5175de51166bfc8e192ade2cb26548c056e7c (patch)
tree48c7e3876bfe30ad99ac18b2f34b9dc2de2a76f6
parent1f0f027fef528ca87a74cad8a12e4684adb6263b (diff)
Change behavior of THttpRequest::getBaseUrl() & THttpRequest::getAbsoluteApplicationUrl() to make it possible to force either http or https
-rw-r--r--HISTORY1
-rw-r--r--UPGRADE9
-rw-r--r--framework/Web/THttpRequest.php18
3 files changed, 22 insertions, 6 deletions
diff --git a/HISTORY b/HISTORY
index f82f407a..7aff6b91 100644
--- a/HISTORY
+++ b/HISTORY
@@ -15,6 +15,7 @@ NEW: Add TActiveMultiView (LCS Team)
NEW: Beta of master/slave senario solution (Yves)
ENH: Update TDraggable::revert property to accept "failure" value (Christophe)
BUG: Issue#246: TQueue::peek returns the top not the bottom (Christophe)
+CHG/ENH: Change behavior of THttpRequest::getBaseUrl() & THttpRequest::getAbsoluteApplicationUrl() to make it possible to force either http or https (Yves)
Version 3.1.7 February 22, 2010
ENH: Issue#24 - Specify needed fields on demand (Yves)
diff --git a/UPGRADE b/UPGRADE
index 6d4dae73..9b98297f 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -9,6 +9,15 @@ if you want to upgrade from version A to version C and there is
version B between A and C, you need to following the instructions
for both A and B.
+Upgrading from v3.1.7
+---------------------
+- behavior of THttpRequest::getBaseUrl() and THttpRequest::getAbsoluteApplicationUrl() changed:
+ null - keep current schema
+ true - force https
+ false - force http
+ relevance, only if invoking methods with explicit "false"
+
+
Upgrading from v3.1.6
---------------------
- The different SQLMap cache engines (TSQLMapFifoCache, TSQLMapLRUCache, TSQLMapApplicationCache) doesn't
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 26630c8c..ed981c90 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -357,7 +357,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
{
return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:'';
}
-
+
/**
* @return string part of that request URL after the host info (including pathinfo and query string)
*/
@@ -367,13 +367,16 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
}
/**
- * @param boolean whether to use HTTPS instead of HTTP even if the current request is sent via HTTP
+ * @param boolean|null whether to use HTTPS instead of HTTP even if the current request is sent via HTTP or vice versa
+ * null - keep current schema
+ * true - force https
+ * false - force http
* @return string schema and hostname of the requested URL
*/
- public function getBaseUrl($forceSecureConnection=false)
+ public function getBaseUrl($forceSecureConnection=null)
{
$url=$this->getUrl();
- $scheme=($forceSecureConnection)?"https":$url->getScheme();
+ $scheme=($forceSecureConnection)?"https": (($forceSecureConnection === null)?$url->getScheme():'http');
$host=$url->getHost();
if (($port=$url->getPort())) $host.=':'.$port;
return $scheme.'://'.$host;
@@ -388,10 +391,13 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
}
/**
- * @param boolean whether to use HTTPS instead of HTTP even if the current request is sent via HTTP
+ * @param boolean|null whether to use HTTPS instead of HTTP even if the current request is sent via HTTP or vice versa
+ * null - keep current schema
+ * true - force https
+ * false - force http
* @return string entry script URL (w/ host part)
*/
- public function getAbsoluteApplicationUrl($forceSecureConnection=false)
+ public function getAbsoluteApplicationUrl($forceSecureConnection=null)
{
return $this->getBaseUrl($forceSecureConnection) . $this->getApplicationUrl();
}