mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-17 06:59:51 +00:00
Formatting
This commit is contained in:
parent
874a1172a1
commit
3f910dc6c1
1 changed files with 30 additions and 39 deletions
|
@ -37,7 +37,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* will be disabled and additional measures to deal with non-standard responses will be enabled.
|
* will be disabled and additional measures to deal with non-standard responses will be enabled.
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public $quirksMode = false;
|
public $quirksMode = false;
|
||||||
|
|
||||||
|
@ -45,7 +44,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* The default values to use for a request
|
* The default values to use for a request
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public $request = array(
|
public $request = array(
|
||||||
'method' => 'GET',
|
'method' => 'GET',
|
||||||
|
@ -74,7 +72,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* The default structure for storing the response
|
* The default structure for storing the response
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public $response = array(
|
public $response = array(
|
||||||
'raw' => array(
|
'raw' => array(
|
||||||
|
@ -97,7 +94,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* Default configuration settings for the HttpSocket
|
* Default configuration settings for the HttpSocket
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public $config = array(
|
public $config = array(
|
||||||
'persistent' => false,
|
'persistent' => false,
|
||||||
|
@ -119,7 +115,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* String that represents a line break.
|
* String that represents a line break.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public $lineBreak = "\r\n";
|
public $lineBreak = "\r\n";
|
||||||
|
|
||||||
|
@ -127,7 +122,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* Authentication settings
|
* Authentication settings
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access protected
|
|
||||||
*/
|
*/
|
||||||
protected $_auth = array();
|
protected $_auth = array();
|
||||||
|
|
||||||
|
@ -135,7 +129,6 @@ class HttpSocket extends CakeSocket {
|
||||||
* Proxy settings
|
* Proxy settings
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access protected
|
|
||||||
*/
|
*/
|
||||||
protected $_proxy = array();
|
protected $_proxy = array();
|
||||||
|
|
||||||
|
@ -504,6 +497,7 @@ class HttpSocket extends CakeSocket {
|
||||||
* Set the proxy configuration and authentication
|
* Set the proxy configuration and authentication
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function _setProxyConfig() {
|
protected function _setProxyConfig() {
|
||||||
if (empty($this->_proxy) || !isset($this->_proxy['host'], $this->_proxy['port'])) {
|
if (empty($this->_proxy) || !isset($this->_proxy['host'], $this->_proxy['port'])) {
|
||||||
|
@ -1004,10 +998,9 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* @param array $header Header array containing one ore more 'Set-Cookie' headers.
|
* @param array $header Header array containing one ore more 'Set-Cookie' headers.
|
||||||
* @return mixed Either false on no cookies, or an array of cookies recieved.
|
* @return mixed Either false on no cookies, or an array of cookies recieved.
|
||||||
* @access public
|
|
||||||
* @todo Make this 100% RFC 2965 confirm
|
* @todo Make this 100% RFC 2965 confirm
|
||||||
*/
|
*/
|
||||||
function parseCookies($header) {
|
public function parseCookies($header) {
|
||||||
if (!isset($header['Set-Cookie'])) {
|
if (!isset($header['Set-Cookie'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1046,28 +1039,26 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* @param array $cookies Array of cookies to send with the request.
|
* @param array $cookies Array of cookies to send with the request.
|
||||||
* @return string Cookie header string to be sent with the request.
|
* @return string Cookie header string to be sent with the request.
|
||||||
* @access public
|
|
||||||
* @todo Refactor token escape mechanism to be configurable
|
* @todo Refactor token escape mechanism to be configurable
|
||||||
*/
|
*/
|
||||||
function buildCookies($cookies) {
|
public function buildCookies($cookies) {
|
||||||
$header = array();
|
$header = array();
|
||||||
foreach ($cookies as $name => $cookie) {
|
foreach ($cookies as $name => $cookie) {
|
||||||
$header[] = $name . '=' . $this->_escapeToken($cookie['value'], array(';'));
|
$header[] = $name . '=' . $this->_escapeToken($cookie['value'], array(';'));
|
||||||
}
|
}
|
||||||
$header = $this->_buildHeader(array('Cookie' => implode('; ', $header)), 'pragmatic');
|
return $this->_buildHeader(array('Cookie' => implode('; ', $header)), 'pragmatic');
|
||||||
return $header;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unescapes a given $token according to RFC 2616 (HTTP 1.1 specs)
|
* Unescapes a given $token according to RFC 2616 (HTTP 1.1 specs)
|
||||||
*
|
*
|
||||||
* @param string $token Token to unescape
|
* @param string $token Token to unescape
|
||||||
|
* @param array $chars
|
||||||
* @return string Unescaped token
|
* @return string Unescaped token
|
||||||
* @access protected
|
|
||||||
* @todo Test $chars parameter
|
* @todo Test $chars parameter
|
||||||
*/
|
*/
|
||||||
function _unescapeToken($token, $chars = null) {
|
protected function _unescapeToken($token, $chars = null) {
|
||||||
$regex = '/"(['.join('', $this->_tokenEscapeChars(true, $chars)).'])"/';
|
$regex = '/"([' . implode('', $this->_tokenEscapeChars(true, $chars)) . '])"/';
|
||||||
$token = preg_replace($regex, '\\1', $token);
|
$token = preg_replace($regex, '\\1', $token);
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
@ -1076,12 +1067,12 @@ class HttpSocket extends CakeSocket {
|
||||||
* Escapes a given $token according to RFC 2616 (HTTP 1.1 specs)
|
* Escapes a given $token according to RFC 2616 (HTTP 1.1 specs)
|
||||||
*
|
*
|
||||||
* @param string $token Token to escape
|
* @param string $token Token to escape
|
||||||
|
* @param array $chars
|
||||||
* @return string Escaped token
|
* @return string Escaped token
|
||||||
* @access protected
|
|
||||||
* @todo Test $chars parameter
|
* @todo Test $chars parameter
|
||||||
*/
|
*/
|
||||||
function _escapeToken($token, $chars = null) {
|
protected function _escapeToken($token, $chars = null) {
|
||||||
$regex = '/(['.join('', $this->_tokenEscapeChars(true, $chars)).'])/';
|
$regex = '/([' . implode('', $this->_tokenEscapeChars(true, $chars)) . '])/';
|
||||||
$token = preg_replace($regex, '"\\1"', $token);
|
$token = preg_replace($regex, '"\\1"', $token);
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
@ -1090,11 +1081,11 @@ class HttpSocket extends CakeSocket {
|
||||||
* Gets escape chars according to RFC 2616 (HTTP 1.1 specs).
|
* Gets escape chars according to RFC 2616 (HTTP 1.1 specs).
|
||||||
*
|
*
|
||||||
* @param boolean $hex true to get them as HEX values, false otherwise
|
* @param boolean $hex true to get them as HEX values, false otherwise
|
||||||
|
* @param array $chars
|
||||||
* @return array Escape chars
|
* @return array Escape chars
|
||||||
* @access protected
|
|
||||||
* @todo Test $chars parameter
|
* @todo Test $chars parameter
|
||||||
*/
|
*/
|
||||||
function _tokenEscapeChars($hex = true, $chars = null) {
|
protected function _tokenEscapeChars($hex = true, $chars = null) {
|
||||||
if (!empty($chars)) {
|
if (!empty($chars)) {
|
||||||
$escape = $chars;
|
$escape = $chars;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue