summaryrefslogtreecommitdiffstats
path: root/system/core/Config.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-11-09 09:56:30 +0100
committerAndrey Andreev <narf@devilix.net>2015-11-09 09:56:30 +0100
commitcd4e547abbe9e5f4d48bd54d7fc136a01033b480 (patch)
tree3627eb3c58c5256c6ecfa314145ab004169ec9bd /system/core/Config.php
parent6c4daef7ace73e1e9bacb511f646ade778763ff9 (diff)
parentae480daecb0f7aeed017c5cc5a67cc39b90be570 (diff)
Merge pull request #4217 from natesilva/fix-ipv6-base_url
Build base_url correctly if SERVER_ADDR is IPv6
Diffstat (limited to 'system/core/Config.php')
-rw-r--r--system/core/Config.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index 0264776f9..c507f342c 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -90,7 +90,16 @@ class CI_Config {
{
if (isset($_SERVER['SERVER_ADDR']))
{
- $base_url = (is_https() ? 'https' : 'http').'://'.$_SERVER['SERVER_ADDR']
+ if (strpos($_SERVER['SERVER_ADDR'], ':') !== FALSE)
+ {
+ $server_addr = '['.$_SERVER['SERVER_ADDR'].']';
+ }
+ else
+ {
+ $server_addr = $_SERVER['SERVER_ADDR'];
+ }
+
+ $base_url = (is_https() ? 'https' : 'http').'://'.$server_addr
.substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
}
else