Jesus M. Castagnetto 11 anni fa
parent
commit
a5f8b05912
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8 2
      lib/pico.php

+ 8 - 2
lib/pico.php

@@ -302,8 +302,14 @@ class Pico {
 	 */
 	private function get_protocol()
 	{
-		preg_match("|^HTTP[S]?|is",$_SERVER['SERVER_PROTOCOL'],$m);
-		return strtolower($m[0]);
+        // need to check if HTTPS is set and is not 'off' (and ISAPI/IIS 
+        // peculiarity)
+        if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] !== 'off')) {
+            $protocol = 'https';
+        } else {
+            $protocol = 'http';
+        }
+		return $protocol;
 	}
 	     
 	/**