diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 64ba72d68ea5bc41d355bce9847ac606f44198e9..ef2845c056e1475b2d44b1acc77cae653d110169 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -50,17 +50,6 @@ class SimpleSAML_Utilities { return $currenthost;# . self::getFirstPathElement() ; } - /** - * Will return https - */ - public static function getSelfProtocol() { - $s = empty($_SERVER["HTTPS"]) ? '' - : ($_SERVER["HTTPS"] == "on") ? 's' - : ''; - if ( empty($_SERVER["HTTPS"]) && $_SERVER["SERVER_PORT"] == 443) $s = 's'; - $protocol = self::strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; - return $protocol; - } /** * Will return https://sp.example.org @@ -68,8 +57,12 @@ class SimpleSAML_Utilities { public static function selfURLhost() { $currenthost = self::getSelfHost(); - - $protocol = self::getSelfProtocol(); + + if (SimpleSAML_Utilities::isHTTPS()) { + $protocol = 'https'; + } else { + $protocol = 'http'; + } $portnumber = $_SERVER["SERVER_PORT"]; $port = ':' . $portnumber; diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index d20e37cbf3cc77fd9082bdbb26f4689919189e02..7374b022e98330295e20610830eeb1eaba5e8a51 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -16,7 +16,7 @@ $isadmin = SimpleSAML_Utilities::isAdmin(); $warnings = array(); -if (SimpleSAML_Utilities::getSelfProtocol() != 'https') { +if (!SimpleSAML_Utilities::isHTTPS()) { $warnings[] = '{core:frontpage:warnings_https}'; } diff --git a/www/example-simple/hostnames.php b/www/example-simple/hostnames.php index 690bf62e3f1928b8e9093314970d1edf57f4ddbb..8b9194452e8c754347844357016e60f6bf0f0335 100644 --- a/www/example-simple/hostnames.php +++ b/www/example-simple/hostnames.php @@ -22,7 +22,6 @@ $attributes['SERVER_PROTOCOL'] = array($_SERVER['SERVER_PROTOCOL']); $attributes['SERVER_PORT'] = array($_SERVER['SERVER_PORT']); $attributes['Utilities_getSelfHost()'] = array(SimpleSAML_Utilities::getSelfHost()); -$attributes['Utilities_getSelfProtocol()'] = array(SimpleSAML_Utilities::getSelfProtocol()); $attributes['Utilities_selfURLhost()'] = array(SimpleSAML_Utilities::selfURLhost()); $attributes['Utilities_selfURLNoQuery()'] = array(SimpleSAML_Utilities::selfURLNoQuery()); $attributes['Utilities_getScriptName()'] = array(SimpleSAML_Utilities::getScriptName());