Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 185 changed files with 375 additions and 373 deletions.
2 changes: 1 addition & 1 deletion src/AbstractMessage.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
24 changes: 12 additions & 12 deletions src/Client.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down Expand Up @@ -434,7 +434,7 @@ public function getCookies()
* Get the cookie Id (name+domain+path)
*
* @param Header\SetCookie|Header\Cookie $cookie
* @return string|boolean
* @return string|bool
*/
protected function getCookieId($cookie)
{
Expand All @@ -452,8 +452,8 @@ protected function getCookieId($cookie)
* @param string $expire
* @param string $path
* @param string $domain
* @param boolean $secure
* @param boolean $httponly
* @param bool $secure
* @param bool $httponly
* @param string $maxAge
* @param string $version
* @throws Exception\InvalidArgumentException
Expand Down Expand Up @@ -533,7 +533,7 @@ public function setHeaders($headers)
* Check if exists the header type specified
*
* @param string $name
* @return boolean
* @return bool
*/
public function hasHeader($name)
{
Expand All @@ -550,7 +550,7 @@ public function hasHeader($name)
* Get the header value of the request
*
* @param string $name
* @return string|boolean
* @return string|bool
*/
public function getHeader($name)
{
Expand All @@ -567,7 +567,7 @@ public function getHeader($name)
/**
* Set streaming for received data
*
* @param string|boolean $streamfile Stream file, true for temp file, false/null for no streaming
* @param string|bool $streamfile Stream file, true for temp file, false/null for no streaming
* @return \Zend\Http\Client
*/
public function setStream($streamfile = true)
Expand All @@ -578,7 +578,7 @@ public function setStream($streamfile = true)

/**
* Get status of streaming for received data
* @return boolean|string
* @return bool|string
*/
public function getStream()
{
Expand Down Expand Up @@ -659,7 +659,7 @@ public function setAuth($user, $password, $type = self::AUTH_BASIC)
* @param array $digest
* @param null|string $entityBody
* @throws Exception\InvalidArgumentException
* @return string|boolean
* @return string|bool
*/
protected function calcAuthDigest($user, $password, $type = self::AUTH_BASIC, $digest = array(), $entityBody = null)
{
Expand Down Expand Up @@ -963,7 +963,7 @@ public function setFileUpload($filename, $formname, $data = null, $ctype = null)
* Remove a file to upload
*
* @param string $filename
* @return boolean
* @return bool
*/
public function removeFileUpload($filename)
{
Expand All @@ -981,7 +981,7 @@ public function removeFileUpload($filename)
* @param string $domain
* @param string $path
* @param boolean $secure
* @return Header\Cookie|boolean
* @return Header\Cookie|bool
*/
protected function prepareCookies($domain, $path, $secure)
{
Expand Down Expand Up @@ -1275,7 +1275,7 @@ protected function flattenParametersArray($parray, $prefix = null)
*
* @param Http $uri
* @param string $method
* @param boolean $secure
* @param bool $secure
* @param array $headers
* @param string $body
* @return string the raw response
Expand Down
8 changes: 4 additions & 4 deletions src/Client/Adapter/AdapterInterface.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down Expand Up @@ -34,7 +34,7 @@ public function setOptions($options = array());
*
* @param string $host
* @param int $port
* @param boolean $secure
* @param bool $secure
*/
public function connect($host, $port = 80, $secure = false);

Expand All @@ -43,12 +43,12 @@ public function connect($host, $port = 80, $secure = false);
*
* @param string $method
* @param \Zend\Uri\Uri $url
* @param string $http_ver
* @param string $httpVer
* @param array $headers
* @param string $body
* @return string Request as text
*/
public function write($method, $url, $http_ver = '1.1', $headers = array(), $body = '');
public function write($method, $url, $httpVer = '1.1', $headers = array(), $body = '');

/**
* Read response from server
Expand Down
4 changes: 2 additions & 2 deletions src/Client/Adapter/Curl.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down Expand Up @@ -178,7 +178,7 @@ public function setCurlOption($option, $value)
*
* @param string $host
* @param int $port
* @param boolean $secure
* @param bool $secure
* @return void
* @throws AdapterException\RuntimeException if unable to connect
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Exception/ExceptionInterface.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Exception/InitializationException.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Exception/InvalidArgumentException.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Exception/OutOfRangeException.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Exception/RuntimeException.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Adapter/Exception/TimeoutException.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down
32 changes: 17 additions & 15 deletions src/Client/Adapter/Proxy.php
Expand Up @@ -3,7 +3,7 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Http
*/
Expand Down Expand Up @@ -54,7 +54,7 @@ class Proxy extends Socket
/**
* Whether HTTPS CONNECT was already negotiated with the proxy or not
*
* @var boolean
* @var bool
*/
protected $negotiated = false;

Expand Down Expand Up @@ -84,13 +84,15 @@ public function setOptions($options = array())
*
* @param string $host
* @param int $port
* @param boolean $secure
* @param bool $secure
* @throws AdapterException\RuntimeException
*/
public function connect($host, $port = 80, $secure = false)
{
// If no proxy is set, fall back to Socket adapter
if (! $this->config['proxy_host']) {
return parent::connect($host, $port, $secure);
parent::connect($host, $port, $secure);
return;
}

/* Url might require stream context even if proxy connection doesn't */
Expand All @@ -99,7 +101,7 @@ public function connect($host, $port = 80, $secure = false)
}

// Connect (a non-secure connection) to the proxy server
return parent::connect(
parent::connect(
$this->config['proxy_host'],
$this->config['proxy_port'],
false
Expand All @@ -111,16 +113,16 @@ public function connect($host, $port = 80, $secure = false)
*
* @param string $method
* @param \Zend\Uri\Uri $uri
* @param string $http_ver
* @param string $httpVer
* @param array $headers
* @param string $body
* @throws AdapterException\RuntimeException
* @return string Request as string
*/
public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
public function write($method, $uri, $httpVer = '1.1', $headers = array(), $body = '')
{
// If no proxy is set, fall back to default Socket adapter
if (! $this->config['proxy_host']) return parent::write($method, $uri, $http_ver, $headers, $body);
if (! $this->config['proxy_host']) return parent::write($method, $uri, $httpVer, $headers, $body);

// Make sure we're properly connected
if (! $this->socket) {
Expand All @@ -130,7 +132,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
$host = $this->config['proxy_host'];
$port = $this->config['proxy_port'];

if ($this->connected_to[0] != "tcp://$host" || $this->connected_to[1] != $port) {
if ($this->connectedTo[0] != "tcp://$host" || $this->connectedTo[1] != $port) {
throw new AdapterException\RuntimeException("Trying to write but we are connected to the wrong proxy server");
}

Expand All @@ -143,7 +145,7 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod

// if we are proxying HTTPS, preform CONNECT handshake with the proxy
if ($uri->getScheme() == 'https' && (! $this->negotiated)) {
$this->connectHandshake($uri->getHost(), $uri->getPort(), $http_ver, $headers);
$this->connectHandshake($uri->getHost(), $uri->getPort(), $httpVer, $headers);
$this->negotiated = true;
}

Expand All @@ -156,9 +158,9 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
if ($uri->getQuery()) {
$path .= '?' . $uri->getQuery();
}
$request = "$method $path HTTP/$http_ver\r\n";
$request = "$method $path HTTP/$httpVer\r\n";
} else {
$request = "$method $uri HTTP/$http_ver\r\n";
$request = "$method $uri HTTP/$httpVer\r\n";
}

// Add all headers to the request string
Expand Down Expand Up @@ -196,13 +198,13 @@ public function write($method, $uri, $http_ver = '1.1', $headers = array(), $bod
*
* @param string $host
* @param integer $port
* @param string $http_ver
* @param string $httpVer
* @param array $headers
* @throws AdapterException\RuntimeException
*/
protected function connectHandshake($host, $port = 443, $http_ver = '1.1', array &$headers = array())
protected function connectHandshake($host, $port = 443, $httpVer = '1.1', array &$headers = array())
{
$request = "CONNECT $host:$port HTTP/$http_ver\r\n" .
$request = "CONNECT $host:$port HTTP/$httpVer\r\n" .
"Host: " . $this->config['proxy_host'] . "\r\n";

// Add the user-agent header
Expand Down

0 comments on commit a6c1451

Please sign in to comment.