Example #1
0
 /**
  * Constructor.
  *
  * @param string                $uri
  * @param \http\Client\Response $response
  */
 public function __construct($uri, \http\Client\Response $response)
 {
     try {
         $parent = $response->getParentMessage();
         $location = $parent->getHeader('Location');
         $this->uri = $location;
     } catch (HttpRuntimeException $e) {
         $this->uri = $uri;
     }
     $this->httpVersion = $response->getHttpVersion();
     $this->code = $response->getResponseCode();
     $this->_response = $response;
     foreach ($response->getHeaders() as $k => $v) {
         $this->headers[strtolower($k)] = $v;
     }
 }
Example #2
0
 /**
  * Constructor.
  *
  * @param string                $uri
  * @param \http\Client\Response $response
  */
 public function __construct($uri, \http\Client\Response $response)
 {
     try {
         $info = $response->getTransferInfo();
     } catch (\http\Exception $e) {
         throw new Horde_Http_Exception($e);
     }
     try {
         $this->uri = $info->effective_url;
     } catch (\http\Exception\RuntimeException $e) {
         $this->uri = $uri;
     }
     $this->httpVersion = $response->getHttpVersion();
     $this->code = $info->response_code;
     $this->_response = $response;
     $this->_headers = new Horde_Support_CaseInsensitiveArray($response->getHeaders());
     $this->headers = array_change_key_case($this->_headers->getArrayCopy());
 }