File indexing completed on 2025-03-09 05:25:38

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: cache, must-revalidate');
0049                 header('Pragma: public');
0050             }
0051             //header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
0052             //header('Content-Type: application/x-amf');
0053             $duration = 1800; // in seconds
0054             $expires = gmdate("D, d M Y H:i:s", time() + $duration) . " GMT";
0055             header('Expires: '.$expires);
0056             header('Content-Type: application/x-amf');
0057 
0058             
0059         }
0060         
0061         
0062         return parent::getResponse();
0063     }
0064 
0065     protected function isIeOverSsl()
0066     {
0067         $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
0068         if (!$ssl || ($ssl == 'off')) {
0069             // IIS reports "off", whereas other browsers simply don't populate
0070             return false;
0071         }
0072 
0073         $ua  = $_SERVER['HTTP_USER_AGENT'];
0074         if (!preg_match('/; MSIE \d+\.\d+;/', $ua)) {
0075             // Not MicroSoft Internet Explorer
0076             return false;
0077         }
0078 
0079         return true;
0080     }
0081 }