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

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2
Browse files Browse the repository at this point in the history
Fixed files permissions
  • Loading branch information
Show file tree
Hide file tree
Showing 109 changed files with 553 additions and 349 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -21,8 +21,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
"dev-master": "2.1-dev",
"dev-develop": "2.2-dev"
}
},
"autoload-dev": {
Expand Down
3 changes: 0 additions & 3 deletions src/AbstractMessage.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http;
Expand All @@ -15,8 +14,6 @@
/**
* HTTP standard message (Request/Response)
*
* @category Zend
* @package Zend_Http
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
*/
abstract class AbstractMessage extends Message
Expand Down
51 changes: 37 additions & 14 deletions src/Client.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http;
Expand All @@ -19,9 +18,6 @@

/**
* Http client
*
* @category Zend
* @package Zend\Http
*/
class Client implements Stdlib\DispatchableInterface
{
Expand Down Expand Up @@ -113,6 +109,7 @@ class Client implements Stdlib\DispatchableInterface
'keepalive' => false,
'outputstream' => false,
'encodecookies' => true,
'argseparator' => null,
'rfc3986strict' => false
);

Expand Down Expand Up @@ -355,6 +352,33 @@ public function getMethod()
return $this->getRequest()->getMethod();
}

/**
* Set the query string argument separator
*
* @param string $argSeparator
* @return Client
*/
public function setArgSeparator($argSeparator)
{
$this->setOptions(array("argseparator" => $argSeparator));
return $this;
}

/**
* Get the query string argument separator
*
* @return string
*/
public function getArgSeparator()
{
$argSeparator = $this->config['argseparator'];
if (empty($argSeparator)) {
$argSeparator = ini_get('arg_separator.output');
$this->setArgSeparator($argSeparator);
}
return $argSeparator;
}

/**
* Set the encoding type and the boundary (if any)
*
Expand Down Expand Up @@ -469,11 +493,11 @@ public function addCookie($cookie, $value = null, $expire = null, $path = null,
throw new Exception\InvalidArgumentException('The cookie parameter is not a valid Set-Cookie type');
}
}
} elseif ($cookie instanceof Header\SetCookie) {
$this->cookies[$this->getCookieId($cookie)] = $cookie;
} elseif (is_string($cookie) && $value !== null) {
$setCookie = new Header\SetCookie($cookie, $value, $expire, $path, $domain, $secure, $httponly, $maxAge, $version);
$this->cookies[$this->getCookieId($setCookie)] = $setCookie;
} elseif ($cookie instanceof Header\SetCookie) {
$this->cookies[$this->getCookieId($cookie)] = $cookie;
} else {
throw new Exception\InvalidArgumentException('Invalid parameter type passed as Cookie');
}
Expand Down Expand Up @@ -582,7 +606,7 @@ public function setStream($streamfile = true)
*/
public function getStream()
{
if (!is_null($this->streamName)) {
if (null !== $this->streamName) {
return $this->streamName;
}

Expand Down Expand Up @@ -777,14 +801,14 @@ public function send(Request $request = null)

if (!empty($queryArray)) {
$newUri = $uri->toString();
$queryString = http_build_query($query);
$queryString = http_build_query($query, null, $this->getArgSeparator());

if ($this->config['rfc3986strict']) {
$queryString = str_replace('+', '%20', $queryString);
}

if (strpos($newUri, '?') !== false) {
$newUri .= '&' . $queryString;
$newUri .= $this->getArgSeparator() . $queryString;
} else {
$newUri .= '?' . $queryString;
}
Expand Down Expand Up @@ -855,9 +879,9 @@ public function send(Request $request = null)
}

// Get the cookies from response (if any)
$setCookie = $response->getCookie();
if (!empty($setCookie)) {
$this->addCookie($setCookie);
$setCookies = $response->getCookie();
if (!empty($setCookies)) {
$this->addCookie($setCookies);
}

// If we got redirected, look for the Location header
Expand Down Expand Up @@ -1294,7 +1318,6 @@ protected function doRequest(Http $uri, $method, $secure = false, $headers = arr
throw new Exception\RuntimeException('Adapter does not support streaming');
}
}

// HTTP connection
$this->lastRawRequest = $this->adapter->write($method,
$uri, $this->config['httpversion'], $headers, $body);
Expand All @@ -1311,7 +1334,7 @@ protected function doRequest(Http $uri, $method, $secure = false, $headers = arr
* @param string $password
* @param string $type
* @return string
* @throws Zend\Http\Client\Exception\InvalidArgumentException
* @throws Client\Exception\InvalidArgumentException
*/
public static function encodeAuthHeader($user, $password, $type = self::AUTH_BASIC)
{
Expand Down
5 changes: 0 additions & 5 deletions src/Client/Adapter/AdapterInterface.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter;
Expand All @@ -15,10 +14,6 @@
*
* These classes are used as connectors for Zend_Http_Client, performing the
* tasks of connecting, writing, reading and closing connection to the server.
*
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
interface AdapterInterface
{
Expand Down
8 changes: 2 additions & 6 deletions src/Client/Adapter/Curl.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter;
Expand All @@ -20,10 +19,6 @@
/**
* An adapter class for Zend\Http\Client based on the curl extension.
* Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl
*
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
class Curl implements HttpAdapter, StreamInterface
{
Expand Down Expand Up @@ -374,6 +369,7 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $bo
foreach ($headers as $key => $value) {
$curlHeaders[] = $key . ': ' . $value;
}

curl_setopt($this->curl, CURLOPT_HTTPHEADER, $curlHeaders);

/**
Expand Down Expand Up @@ -409,8 +405,8 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $bo
}

// send the request
$response = curl_exec($this->curl);

$response = curl_exec($this->curl);
// if we used streaming, headers are already there
if (!is_resource($this->outputStream)) {
$this->response = $response;
Expand Down
6 changes: 0 additions & 6 deletions src/Client/Adapter/Exception/ExceptionInterface.php
Expand Up @@ -5,17 +5,11 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter\Exception;

use Zend\Http\Client\Exception\ExceptionInterface as HttpClientException;

/**
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
interface ExceptionInterface extends HttpClientException
{}
4 changes: 0 additions & 4 deletions src/Client/Adapter/Exception/InitializationException.php
Expand Up @@ -5,15 +5,11 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter\Exception;

/**
*
* @category Zend
* @package Zend_Application
*/
class InitializationException extends RuntimeException
{}
4 changes: 0 additions & 4 deletions src/Client/Adapter/Exception/InvalidArgumentException.php
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter\Exception;

use Zend\Http\Client\Exception;

/**
*
* @category Zend
* @package Zend_Application
*/
class InvalidArgumentException extends Exception\InvalidArgumentException implements
ExceptionInterface
Expand Down
4 changes: 0 additions & 4 deletions src/Client/Adapter/Exception/OutOfRangeException.php
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter\Exception;

use Zend\Http\Client\Exception;

/**
*
* @category Zend
* @package Zend_Application
*/
class OutOfRangeException extends Exception\OutOfRangeException implements
ExceptionInterface
Expand Down
4 changes: 0 additions & 4 deletions src/Client/Adapter/Exception/RuntimeException.php
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter\Exception;

use Zend\Http\Client\Exception;

/**
*
* @category Zend
* @package Zend_Application
*/
class RuntimeException extends Exception\RuntimeException implements
ExceptionInterface
Expand Down
4 changes: 0 additions & 4 deletions src/Client/Adapter/Exception/TimeoutException.php
Expand Up @@ -5,15 +5,11 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter\Exception;

/**
*
* @category Zend
* @package Zend_Application
*/
class TimeoutException extends RuntimeException implements ExceptionInterface
{
Expand Down
5 changes: 0 additions & 5 deletions src/Client/Adapter/Proxy.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter;
Expand All @@ -23,10 +22,6 @@
* fall back to Zend_Http_Client_Adapter_Socket behavior. Just like the
* default Socket adapter, this adapter does not require any special extensions
* installed.
*
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
class Proxy extends Socket
{
Expand Down
5 changes: 0 additions & 5 deletions src/Client/Adapter/Socket.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter;
Expand All @@ -20,10 +19,6 @@
/**
* A sockets based (stream\socket\client) adapter class for Zend\Http\Client. Can be used
* on almost every PHP environment, and does not require any special extensions.
*
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
class Socket implements HttpAdapter, StreamInterface
{
Expand Down
5 changes: 0 additions & 5 deletions src/Client/Adapter/StreamInterface.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter;
Expand All @@ -14,10 +13,6 @@
* An interface description for Zend_Http_Client_Adapter_Stream classes.
*
* This interface describes Zend_Http_Client_Adapter which supports streaming.
*
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
interface StreamInterface
{
Expand Down
5 changes: 0 additions & 5 deletions src/Client/Adapter/Test.php
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @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
*/

namespace Zend\Http\Client\Adapter;
Expand All @@ -21,10 +20,6 @@
* without actually performing an HTTP request. You should instantiate this
* object manually, and then set it as the client's adapter. Then, you can
* set the expected response using the setResponse() method.
*
* @category Zend
* @package Zend_Http
* @subpackage Client_Adapter
*/
class Test implements AdapterInterface
{
Expand Down

0 comments on commit e669f19

Please sign in to comment.