Просмотр исходного кода

ZF-11776: Conditional headers based on detection of IE over SSL

- IE over SSL breaks with a "Cache-Control: no-cache" header. Detect IE over SSL
  and send headers as done in ZF-5890

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24481 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 14 лет назад
Родитель
Сommit
a783ace40c
1 измененных файлов с 24 добавлено и 2 удалено
  1. 24 2
      library/Zend/Amf/Response/Http.php

+ 24 - 2
library/Zend/Amf/Response/Http.php

@@ -41,11 +41,33 @@ class Zend_Amf_Response_Http extends Zend_Amf_Response
     public function getResponse()
     {
         if (!headers_sent()) {
-            header('Cache-Control: no-cache, must-revalidate');
+            if ($this->isIeOverSsl()) {
+                header('Cache-Control: cache, must-revalidate');
+                header('Pragma: public');
+            } else {
+                header('Cache-Control: no-cache, must-revalidate');
+                header('Pragma: no-cache');
+            }
             header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
-            header('Pragma: no-cache');
             header('Content-Type: application/x-amf');
         }
         return parent::getResponse();
     }
+
+    protected function isIeOverSsl()
+    {
+        $ssl = $_SERVER['HTTPS'];
+        if (!$ssl || ($ssl == 'off')) {
+            // IIS reports "off", whereas other browsers simply don't populate
+            return false;
+        }
+
+        $ua  = $_SERVER['HTTP_USER_AGENT'];
+        if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
+            // Not MicroSoft Internet Explorer
+            return false;
+        }
+
+        return true;
+    }
 }