summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-09-14 13:52:48 +0200
committerAndrey Andreev <narf@devilix.net>2015-09-14 13:52:48 +0200
commit392f8da2ebc22efeb1b688a75c49c1a52e12f0f2 (patch)
tree4170539fc728b44d6368d865807f434ae6cbb8a9
parentc08f27b471816493900702229eb105b0ec117706 (diff)
Close #4098
-rw-r--r--system/core/Config.php20
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 19 insertions, 2 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index d07000ac9..feea7c85a 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -238,7 +238,15 @@ class CI_Config {
if (isset($protocol))
{
- $base_url = $protocol.substr($base_url, strpos($base_url, '://'));
+ // For protocol-relative links
+ if ($protocol === '')
+ {
+ $base_url = substr($base_url, strpos($base_url, '//'));
+ }
+ else
+ {
+ $base_url = $protocol.substr($base_url, strpos($base_url, '://'));
+ }
}
if (empty($uri))
@@ -293,7 +301,15 @@ class CI_Config {
if (isset($protocol))
{
- $base_url = $protocol.substr($base_url, strpos($base_url, '://'));
+ // For protocol-relative links
+ if ($protocol === '')
+ {
+ $base_url = substr($base_url, strpos($base_url, '//'));
+ }
+ else
+ {
+ $base_url = $protocol.substr($base_url, strpos($base_url, '://'));
+ }
}
return $base_url.ltrim($this->_uri_string($uri), '/');
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index a13f2d2ac..e4250a4e6 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -11,6 +11,7 @@ Release Date: Not Released
- Updated the *application/config/constants.php* file to check if constants aren't already defined before doing that.
- Changed :doc:`Loader Library <libraries/loader>` method ``model()`` to only apply ``ucfirst()`` and not ``strtolower()`` to the requested class name.
+ - Changed :doc:`Config Library <libraries/config>` methods ``base_url()``, ``site_url()`` to allow protocol-relative URLs by passing an empty string as the protocol.
Bug fixes for 3.0.2
-------------------