aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Request.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index f80b707d6..a43509ded 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -106,7 +106,8 @@ class Minz_Request {
$https = self::isHttps();
if (!empty($_SERVER['HTTP_HOST'])) {
- $host = $_SERVER['HTTP_HOST'];
+ //Might contain a port number, and mind IPv6 addresses
+ $host = parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST);
} elseif (!empty($_SERVER['SERVER_NAME'])) {
$host = $_SERVER['SERVER_NAME'];
} else {