浏览代码

Fix for issue #78

Jesus M. Castagnetto 11 年之前
父节点
当前提交
a5f8b05912
共有 1 个文件被更改,包括 8 次插入2 次删除
  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;
 	}
 	     
 	/**