From 7eb4c3d8151c4e5103729d47ed5678848dfbdcd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Wed, 3 Dec 2008 12:49:57 +0000
Subject: [PATCH] Fix for HTTPS variable not set properly. checking port
 instead. Thanks to jose alfonso...

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1050 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Utilities.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 11bf5e30d..0cefb473b 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -28,8 +28,9 @@ class SimpleSAML_Utilities {
 	 */
 	public static function getSelfProtocol() {
 		$s = empty($_SERVER["HTTPS"]) ? ''
-			: ($_SERVER["HTTPS"] == "on") ? "s"
-			: "";
+			: ($_SERVER["HTTPS"] == "on") ? 's'
+			: '';
+		if ( empty($_SERVER["HTTPS"]) && $_SERVER["SERVER_PORT"] == 443) $s = 's';
 		$protocol = self::strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
 		return $protocol;
 	}
-- 
GitLab