web/lib/Zend/Http/Response.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    14  * to license@zend.com so we can send you a copy immediately.
    14  * to license@zend.com so we can send you a copy immediately.
    15  *
    15  *
    16  * @category   Zend
    16  * @category   Zend
    17  * @package    Zend_Http
    17  * @package    Zend_Http
    18  * @subpackage Response
    18  * @subpackage Response
    19  * @version    $Id: Response.php 22810 2010-08-08 10:29:09Z shahar $
    19  * @version    $Id: Response.php 25081 2012-11-06 20:59:47Z rob $
    20  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    20  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    21  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    22  */
    22  */
    23 
    23 
    24 /**
    24 /**
    25  * Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It
    25  * Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It
    26  * includes easy access to all the response's different elemts, as well as some
    26  * includes easy access to all the response's different elemts, as well as some
    27  * convenience methods for parsing and validating HTTP responses.
    27  * convenience methods for parsing and validating HTTP responses.
    28  *
    28  *
    29  * @package    Zend_Http
    29  * @package    Zend_Http
    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_Http_Response
    34 class Zend_Http_Response
    35 {
    35 {
    36     /**
    36     /**
   163                 $header = explode(":", $value, 2);
   163                 $header = explode(":", $value, 2);
   164                 if (count($header) != 2) {
   164                 if (count($header) != 2) {
   165                     require_once 'Zend/Http/Exception.php';
   165                     require_once 'Zend/Http/Exception.php';
   166                     throw new Zend_Http_Exception("'{$value}' is not a valid HTTP header");
   166                     throw new Zend_Http_Exception("'{$value}' is not a valid HTTP header");
   167                 }
   167                 }
   168                 
   168 
   169                 $name  = trim($header[0]);
   169                 $name  = trim($header[0]);
   170                 $value = trim($header[1]);
   170                 $value = trim($header[1]);
   171             }
   171             }
   172 
   172 
   173             $this->headers[ucwords(strtolower($name))] = $value;
   173             $this->headers[ucwords(strtolower($name))] = $value;
   639          * This method was adapted from PEAR HTTP_Request2 by (c) Alexey Borzov
   639          * This method was adapted from PEAR HTTP_Request2 by (c) Alexey Borzov
   640          *
   640          *
   641          * @link http://framework.zend.com/issues/browse/ZF-6040
   641          * @link http://framework.zend.com/issues/browse/ZF-6040
   642          */
   642          */
   643         $zlibHeader = unpack('n', substr($body, 0, 2));
   643         $zlibHeader = unpack('n', substr($body, 0, 2));
   644         if ($zlibHeader[1] % 31 == 0) {
   644         if ($zlibHeader[1] % 31 == 0 && ord($body[0]) == 0x78 && in_array(ord($body[1]), array(0x01, 0x5e, 0x9c, 0xda))) {
   645             return gzuncompress($body);
   645             return gzuncompress($body);
   646         } else {
   646         } else {
   647             return gzinflate($body);
   647             return gzinflate($body);
   648         }
   648         }
   649     }
   649     }