From a1141d2dc43edd5bd89b79db6241c4258dc0faf2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 7 Dec 2018 08:39:23 -0500 Subject: [PATCH] remove second use of HTTP_HOST and use a better method of stripping off port from HTTP_HOST --- web/includes/Server.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/web/includes/Server.php b/web/includes/Server.php index 502d0efa5..aba82e79e 100644 --- a/web/includes/Server.php +++ b/web/includes/Server.php @@ -51,13 +51,8 @@ class Server { } else if ( $this->Id() ) { return $this->{'Name'}; } - # Use HTTP_HOST instead of SERVER_NAME here for nginx compatiblity - # ICON: Hi, I just met you, and this is crazy, but I need to strip port. - $host_with_port_maybe = $_SERVER['HTTP_HOST']; - $heres_my_host = preg_replace('/([^:]+)(:\d+)?/','${1}', $host_with_port_maybe); - #Just use it baby - - return $heres_my_host; + $result = explode(':',$_SERVER['HTTP_HOST']); + return $result[0]; } public function Protocol( $new = null ) { @@ -96,12 +91,7 @@ class Server { public function Url( $port = null ) { $url = $this->Protocol().'://'; - if ( $this->Id() ) { - $url .= $this->Hostname(); - } else { - # Use HTTP_HOST instead of SERVER_NAME here for nginx compatiblity - $url .= $_SERVER['HTTP_HOST']; - } + $url .= $this->Hostname(); if ( $port ) { $url .= ':'.$port; } else {