web/lib/Zend/Amf/Response/Http.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Amf
    16  * @package    Zend_Amf
    17  * @subpackage Response
    17  * @subpackage Response
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: Http.php 22096 2010-05-04 15:37:23Z wadearnold $
    20  * @version    $Id: Http.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 /** Zend_Amf_Response */
    23 /** Zend_Amf_Response */
    24 require_once 'Zend/Amf/Response.php';
    24 require_once 'Zend/Amf/Response.php';
    25 
    25 
    26 /**
    26 /**
    27  * Creates the proper http headers and send the serialized AMF stream to standard out.
    27  * Creates the proper http headers and send the serialized AMF stream to standard out.
    28  *
    28  *
    29  * @package    Zend_Amf
    29  * @package    Zend_Amf
    30  * @subpackage Response
    30  * @subpackage Response
    31  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    31  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    32  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    32  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    33  */
    33  */
    34 class Zend_Amf_Response_Http extends Zend_Amf_Response
    34 class Zend_Amf_Response_Http extends Zend_Amf_Response
    35 {
    35 {
    36     /**
    36     /**
    39      * @return string
    39      * @return string
    40      */
    40      */
    41     public function getResponse()
    41     public function getResponse()
    42     {
    42     {
    43         if (!headers_sent()) {
    43         if (!headers_sent()) {
    44             header('Cache-Control: no-cache, must-revalidate');
    44             if ($this->isIeOverSsl()) {
       
    45                 header('Cache-Control: cache, must-revalidate');
       
    46                 header('Pragma: public');
       
    47             } else {
       
    48                 header('Cache-Control: no-cache, must-revalidate');
       
    49                 header('Pragma: no-cache');
       
    50             }
    45             header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
    51             header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
    46             header('Pragma: no-cache');
       
    47             header('Content-Type: application/x-amf');
    52             header('Content-Type: application/x-amf');
    48         }
    53         }
    49         return parent::getResponse();
    54         return parent::getResponse();
    50     }
    55     }
       
    56 
       
    57     protected function isIeOverSsl()
       
    58     {
       
    59         $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
       
    60         if (!$ssl || ($ssl == 'off')) {
       
    61             // IIS reports "off", whereas other browsers simply don't populate
       
    62             return false;
       
    63         }
       
    64 
       
    65         $ua  = $_SERVER['HTTP_USER_AGENT'];
       
    66         if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
       
    67             // Not MicroSoft Internet Explorer
       
    68             return false;
       
    69         }
       
    70 
       
    71         return true;
       
    72     }
    51 }
    73 }