/usr/share/php/Horde/Http/Request/Base.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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | <?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
*/
abstract class Horde_Http_Request_Base
{
/**
* Request headers
* @var array
*/
protected $_headers = array();
/**
* @var array
*/
protected $_options = array();
/**
* Constructor
*/
public function __construct($options = array())
{
$this->setOptions($options);
}
public function setOptions($options = array())
{
$this->_options = array_merge($this->getDefaultOptions(), $options);
}
public function getDefaultOptions()
{
return array(
'uri' => null,
'method' => 'GET',
'data' => null,
'username' => '',
'password' => '',
'authenticationScheme' => Horde_Http::AUTH_ANY,
'proxyServer' => null,
'proxyPort' => null,
'proxyType' => Horde_Http::PROXY_HTTP,
'proxyUsername' => null,
'proxyPassword' => null,
'proxyAuthenticationScheme' => Horde_Http::AUTH_BASIC,
'redirects' => 5,
'timeout' => 5,
'userAgent' => str_replace(' @' . 'version@', '', 'Horde_Http 2.1.1'),
'verifyPeer' => true,
);
}
/**
* Send this HTTP request
*
* @return Horde_Http_Response_Base
*/
abstract public function send();
/**
* Get an adapter parameter
*
* @param string $name The parameter to get.
* @return mixed Parameter value.
*/
public function __get($name)
{
switch ($name) {
case 'headers':
return $this->_headers;
}
return isset($this->_options[$name]) ? $this->_options[$name] : null;
}
/**
* Set a request parameter
*
* @param string $name The parameter to set.
* @param mixed $value Parameter value.
*/
public function __set($name, $value)
{
switch ($name) {
case 'headers':
$this->setHeaders($value);
break;
}
$this->_options[$name] = $value;
}
/**
* Set one or more headers
*
* @param mixed $headers A hash of header + value pairs, or a single header name
* @param string $value A header value
*/
public function setHeaders($headers, $value = null)
{
if (!is_array($headers)) {
$headers = array($headers => $value);
}
foreach ($headers as $header => $value) {
$this->_headers[$header] = $value;
}
}
/**
* Get the current value of $header
*
* @param string $header Header name to get
* @return string $header's current value
*/
public function getHeader($header)
{
return isset($this->_headers[$header]) ? $this->_headers[$header] : null;
}
}
|