Skip to content
Snippets Groups Projects
Commit 0fbba118 authored by Olav Morken's avatar Olav Morken
Browse files

Fix code for determining the current hostname.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1595 44740490-163a-0410-bde0-09ae8108e29a
parent 28552e0b
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,15 @@ class SimpleSAML_Utilities { ...@@ -15,7 +15,15 @@ class SimpleSAML_Utilities {
*/ */
public static function getSelfHost() { public static function getSelfHost() {
$currenthost = $_SERVER['HTTP_HOST']; 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, ":")) { if(strstr($currenthost, ":")) {
$currenthostdecomposed = explode(":", $currenthost); $currenthostdecomposed = explode(":", $currenthost);
$currenthost = $currenthostdecomposed[0]; $currenthost = $currenthostdecomposed[0];
......
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