Skip to content
Snippets Groups Projects
Commit 460a6a00 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Remove the private methods getServerHost(), getServerHTTPS() and...

Remove the private methods getServerHost(), getServerHTTPS() and getServerPort() from SimpleSAML_Utilities.
parent 277523f8
No related branches found
No related tags found
No related merge requests found
...@@ -35,32 +35,6 @@ class SimpleSAML_Utilities { ...@@ -35,32 +35,6 @@ class SimpleSAML_Utilities {
return \SimpleSAML\Utils\HTTP::getSelfHost(); return \SimpleSAML\Utils\HTTP::getSelfHost();
} }
/**
* Retrieve Host value from $_SERVER environment variables
*/
private static function getServerHost() {
if (array_key_exists('HTTP_HOST', $_SERVER)) {
$currenthost = $_SERVER['HTTP_HOST'];
} elseif (array_key_exists('SERVER_NAME', $_SERVER)) {
$currenthost = $_SERVER['SERVER_NAME'];
} else {
/* Almost certainly not what you want, but ... */
$currenthost = 'localhost';
}
if(strstr($currenthost, ":")) {
$currenthostdecomposed = explode(":", $currenthost);
$port = array_pop($currenthostdecomposed);
if (!is_numeric($port)) {
array_push($currenthostdecomposed, $port);
}
$currenthost = implode($currenthostdecomposed, ":");
}
return $currenthost;
}
/** /**
* Will return https://sp.example.org[:PORT] * Will return https://sp.example.org[:PORT]
...@@ -96,50 +70,6 @@ class SimpleSAML_Utilities { ...@@ -96,50 +70,6 @@ class SimpleSAML_Utilities {
} }
/**
* retrieve HTTPS status from $_SERVER environment variables
*/
private static function getServerHTTPS() {
if(!array_key_exists('HTTPS', $_SERVER)) {
/* Not an https-request. */
return FALSE;
}
if($_SERVER['HTTPS'] === 'off') {
/* IIS with HTTPS off. */
return FALSE;
}
/* Otherwise, HTTPS will be a non-empty string. */
return $_SERVER['HTTPS'] !== '';
}
/**
* Retrieve port number from $_SERVER environment variables
* return it as a string such as ":80" if different from
* protocol default port, otherwise returns an empty string
*/
private static function getServerPort() {
if (isset($_SERVER["SERVER_PORT"])) {
$portnumber = $_SERVER["SERVER_PORT"];
} else {
$portnumber = 80;
}
$port = ':' . $portnumber;
if (self::getServerHTTPS()) {
if ($portnumber == '443') $port = '';
} else {
if ($portnumber == '80') $port = '';
}
return $port;
}
/** /**
* Will return https://sp.example.org/universities/ruc/baz/simplesaml/saml2/SSOService.php * Will return https://sp.example.org/universities/ruc/baz/simplesaml/saml2/SSOService.php
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment