/usr/share/php/Horde/Http/Response/Curl.php is in php-horde-http 2.1.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | <?php
/**
* Copyright 2007-2014 Horde LLC (http://www.horde.org/)
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Http
*/
/**
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Http
*/
class Horde_Http_Response_Curl extends Horde_Http_Response_Base
{
/**
* Info on the request obtained from curl_getinfo().
*
* @var array
*/
protected $_info = array();
/**
* Response body.
*
* @var string
*/
protected $_body;
/**
* Constructor.
*
* @param string $uri
* @param string $curlresult
* @param array $curlinfo
*/
public function __construct($uri, $curlresult, $curlinfo)
{
$this->uri = $uri;
$this->_parseResult($curlresult);
$this->_parseInfo($curlinfo);
}
/**
* Returns the body of the HTTP response.
*
* @return string HTTP response body.
*/
public function getBody()
{
return $this->_body;
}
/**
* Parses the combined header/body result from cURL.
*
* @param string $curlresult
*/
protected function _parseResult($curlresult)
{
/* Curl returns multiple headers, if the last action required multiple
* requests, e.g. when doing Digest authentication. Only parse the
* headers of the latest response. */
preg_match_all('/(^|\r\n\r\n)(HTTP\/)/', $curlresult, $matches, PREG_OFFSET_CAPTURE);
$startOfHeaders = $matches[2][count($matches[2]) - 1][1];
$endOfHeaders = strpos($curlresult, "\r\n\r\n", $startOfHeaders);
$headers = substr($curlresult, $startOfHeaders, $endOfHeaders - $startOfHeaders);
$this->_parseHeaders($headers);
$this->_body = substr($curlresult, $endOfHeaders + 4);
}
/**
* Processes the results of curl_getinfo.
*
* @param array $curlinfo
*/
protected function _parseInfo($curlinfo)
{
$this->uri = $curlinfo['url'];
$this->code = $curlinfo['http_code'];
$this->_info = $curlinfo;
}
}
|