From ad52a53e94d4fa96c32e3bf5293301c65f8ba73c Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Fri, 9 Jul 2010 06:54:39 +0000 Subject: [PATCH] Remove Utilities::getSelfProtocol(). git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2390 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Utilities.php | 19 ++++++------------- modules/core/www/frontpage_config.php | 2 +- www/example-simple/hostnames.php | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 64ba72d68..ef2845c05 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 d20e37cbf..7374b022e 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 690bf62e3..8b9194452 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()); -- GitLab