Skip to content
Snippets Groups Projects
Commit d6748bea authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

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
parent 06b4d810
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,12 @@ class SimpleSAML_Utilities { ...@@ -21,6 +21,12 @@ class SimpleSAML_Utilities {
public static function selfURLNoQuery() { public static function selfURLNoQuery() {
$currenthost = $_SERVER['HTTP_HOST'];
if(strstr($currenthost, ":")) {
$currenthostdecomposed = explode(":", $currenthost);
$currenthost = $currenthostdecomposed[0];
}
$s = empty($_SERVER["HTTPS"]) ? '' $s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s" : ($_SERVER["HTTPS"] == "on") ? "s"
: ""; : "";
...@@ -28,12 +34,18 @@ class SimpleSAML_Utilities { ...@@ -28,12 +34,18 @@ class SimpleSAML_Utilities {
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" $port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]); : (":".$_SERVER["SERVER_PORT"]);
$querystring = ''; $querystring = '';
return $protocol."://".$_SERVER['HTTP_HOST'].$port . $_SERVER['SCRIPT_NAME']; return $protocol."://" . $currenthost . $port . $_SERVER['SCRIPT_NAME'];
} }
public static function selfURL() { public static function selfURL() {
$currenthost = $_SERVER['HTTP_HOST'];
if(strstr($currenthost, ":")) {
$currenthostdecomposed = explode(":", $currenthost);
$currenthost = $currenthostdecomposed[0];
}
$s = empty($_SERVER["HTTPS"]) ? '' $s = empty($_SERVER["HTTPS"]) ? ''
: ($_SERVER["HTTPS"] == "on") ? "s" : ($_SERVER["HTTPS"] == "on") ? "s"
: ""; : "";
...@@ -41,7 +53,8 @@ class SimpleSAML_Utilities { ...@@ -41,7 +53,8 @@ class SimpleSAML_Utilities {
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" $port = ($_SERVER["SERVER_PORT"] == "80") ? ""
: (":".$_SERVER["SERVER_PORT"]); : (":".$_SERVER["SERVER_PORT"]);
$querystring = ''; $querystring = '';
return $protocol."://".$_SERVER['HTTP_HOST'].$port.$_SERVER['REQUEST_URI']; return $protocol . "://" . $currenthost . $port . $_SERVER['REQUEST_URI'];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment