From d6748bea3cb860b0ef290ca395a9d91e0cc4da34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Fri, 28 Sep 2007 16:38:05 +0000 Subject: [PATCH] Fixing getting correct URL in utilities when sending Host: foo:443. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@15 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Utilities.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 6b6af783e..361acd85f 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -21,6 +21,12 @@ class SimpleSAML_Utilities { public static function selfURLNoQuery() { + $currenthost = $_SERVER['HTTP_HOST']; + if(strstr($currenthost, ":")) { + $currenthostdecomposed = explode(":", $currenthost); + $currenthost = $currenthostdecomposed[0]; + } + $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; @@ -28,12 +34,18 @@ class SimpleSAML_Utilities { $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); $querystring = ''; - return $protocol."://".$_SERVER['HTTP_HOST'].$port . $_SERVER['SCRIPT_NAME']; + return $protocol."://" . $currenthost . $port . $_SERVER['SCRIPT_NAME']; } public static function selfURL() { + $currenthost = $_SERVER['HTTP_HOST']; + if(strstr($currenthost, ":")) { + $currenthostdecomposed = explode(":", $currenthost); + $currenthost = $currenthostdecomposed[0]; + } + $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; @@ -41,7 +53,8 @@ class SimpleSAML_Utilities { $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); $querystring = ''; - return $protocol."://".$_SERVER['HTTP_HOST'].$port.$_SERVER['REQUEST_URI']; + return $protocol . "://" . $currenthost . $port . $_SERVER['REQUEST_URI']; + } -- GitLab