File indexing completed on 2025-03-02 05:29:10

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Amf
0017  * @subpackage Response
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /** Zend_Amf_Response */
0024 // require_once 'Zend/Amf/Response.php';
0025 
0026 /**
0027  * Creates the proper http headers and send the serialized AMF stream to standard out.
0028  *
0029  * @package    Zend_Amf
0030  * @subpackage Response
0031  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0032  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0033  */
0034 class Zend_Amf_Response_Http extends Zend_Amf_Response
0035 {
0036     /**
0037      * Create the application response header for AMF and sends the serialized AMF string
0038      *
0039      * @return string
0040      */
0041     public function getResponse()
0042     {
0043         if (!headers_sent()) {
0044             if ($this->isIeOverSsl()) {
0045                 header('Cache-Control: cache, must-revalidate');
0046                 header('Pragma: public');
0047             } else {
0048                 header('Cache-Control: no-cache, must-revalidate');
0049                 header('Pragma: no-cache');
0050             }
0051             header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
0052             header('Content-Type: application/x-amf');
0053         }
0054         return parent::getResponse();
0055     }
0056 
0057     protected function isIeOverSsl()
0058     {
0059         $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
0060         if (!$ssl || ($ssl == 'off')) {
0061             // IIS reports "off", whereas other browsers simply don't populate
0062             return false;
0063         }
0064 
0065         $ua  = $_SERVER['HTTP_USER_AGENT'];
0066         if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
0067             // Not MicroSoft Internet Explorer
0068             return false;
0069         }
0070 
0071         return true;
0072     }
0073 }