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

Commit f897f74

Browse files

File tree

106 files changed

+460
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+460
-328
lines changed

src/AbstractMessage.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http;
@@ -15,8 +14,6 @@
1514
/**
1615
* HTTP standard message (Request/Response)
1716
*
18-
* @category Zend
19-
* @package Zend_Http
2017
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4
2118
*/
2219
abstract class AbstractMessage extends Message

src/Client.php

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http;
@@ -19,9 +18,6 @@
1918

2019
/**
2120
* Http client
22-
*
23-
* @category Zend
24-
* @package Zend\Http
2521
*/
2622
class Client implements Stdlib\DispatchableInterface
2723
{
@@ -113,6 +109,7 @@ class Client implements Stdlib\DispatchableInterface
113109
'keepalive' => false,
114110
'outputstream' => false,
115111
'encodecookies' => true,
112+
'argseparator' => null,
116113
'rfc3986strict' => false
117114
);
118115

@@ -355,6 +352,33 @@ public function getMethod()
355352
return $this->getRequest()->getMethod();
356353
}
357354

355+
/**
356+
* Set the query string argument separator
357+
*
358+
* @param string $argSeparator
359+
* @return Client
360+
*/
361+
public function setArgSeparator($argSeparator)
362+
{
363+
$this->setOptions(array("argseparator" => $argSeparator));
364+
return $this;
365+
}
366+
367+
/**
368+
* Get the query string argument separator
369+
*
370+
* @return string
371+
*/
372+
public function getArgSeparator()
373+
{
374+
$argSeparator = $this->config['argseparator'];
375+
if (empty($argSeparator)) {
376+
$argSeparator = ini_get('arg_separator.output');
377+
$this->setArgSeparator($argSeparator);
378+
}
379+
return $argSeparator;
380+
}
381+
358382
/**
359383
* Set the encoding type and the boundary (if any)
360384
*
@@ -469,11 +493,11 @@ public function addCookie($cookie, $value = null, $expire = null, $path = null,
469493
throw new Exception\InvalidArgumentException('The cookie parameter is not a valid Set-Cookie type');
470494
}
471495
}
472-
} elseif ($cookie instanceof Header\SetCookie) {
473-
$this->cookies[$this->getCookieId($cookie)] = $cookie;
474496
} elseif (is_string($cookie) && $value !== null) {
475497
$setCookie = new Header\SetCookie($cookie, $value, $expire, $path, $domain, $secure, $httponly, $maxAge, $version);
476498
$this->cookies[$this->getCookieId($setCookie)] = $setCookie;
499+
} elseif ($cookie instanceof Header\SetCookie) {
500+
$this->cookies[$this->getCookieId($cookie)] = $cookie;
477501
} else {
478502
throw new Exception\InvalidArgumentException('Invalid parameter type passed as Cookie');
479503
}
@@ -777,14 +801,14 @@ public function send(Request $request = null)
777801

778802
if (!empty($queryArray)) {
779803
$newUri = $uri->toString();
780-
$queryString = http_build_query($query);
804+
$queryString = http_build_query($query, null, $this->getArgSeparator());
781805

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

786810
if (strpos($newUri, '?') !== false) {
787-
$newUri .= '&' . $queryString;
811+
$newUri .= $this->getArgSeparator() . $queryString;
788812
} else {
789813
$newUri .= '?' . $queryString;
790814
}
@@ -855,9 +879,9 @@ public function send(Request $request = null)
855879
}
856880

857881
// Get the cookies from response (if any)
858-
$setCookie = $response->getCookie();
859-
if (!empty($setCookie)) {
860-
$this->addCookie($setCookie);
882+
$setCookies = $response->getCookie();
883+
if (!empty($setCookies)) {
884+
$this->addCookie($setCookies);
861885
}
862886

863887
// If we got redirected, look for the Location header
@@ -1294,7 +1318,6 @@ protected function doRequest(Http $uri, $method, $secure = false, $headers = arr
12941318
throw new Exception\RuntimeException('Adapter does not support streaming');
12951319
}
12961320
}
1297-
12981321
// HTTP connection
12991322
$this->lastRawRequest = $this->adapter->write($method,
13001323
$uri, $this->config['httpversion'], $headers, $body);

src/Client/Adapter/AdapterInterface.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter;
@@ -15,10 +14,6 @@
1514
*
1615
* These classes are used as connectors for Zend_Http_Client, performing the
1716
* tasks of connecting, writing, reading and closing connection to the server.
18-
*
19-
* @category Zend
20-
* @package Zend_Http
21-
* @subpackage Client_Adapter
2217
*/
2318
interface AdapterInterface
2419
{

src/Client/Adapter/Curl.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter;
@@ -20,10 +19,6 @@
2019
/**
2120
* An adapter class for Zend\Http\Client based on the curl extension.
2221
* Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl
23-
*
24-
* @category Zend
25-
* @package Zend_Http
26-
* @subpackage Client_Adapter
2722
*/
2823
class Curl implements HttpAdapter, StreamInterface
2924
{
@@ -374,6 +369,7 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $bo
374369
foreach ($headers as $key => $value) {
375370
$curlHeaders[] = $key . ': ' . $value;
376371
}
372+
377373
curl_setopt($this->curl, CURLOPT_HTTPHEADER, $curlHeaders);
378374

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

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

409+
$response = curl_exec($this->curl);
414410
// if we used streaming, headers are already there
415411
if (!is_resource($this->outputStream)) {
416412
$this->response = $response;

src/Client/Adapter/Exception/ExceptionInterface.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,11 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter\Exception;
1211

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

15-
/**
16-
* @category Zend
17-
* @package Zend_Http
18-
* @subpackage Client_Adapter
19-
*/
2014
interface ExceptionInterface extends HttpClientException
2115
{}

src/Client/Adapter/Exception/InitializationException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter\Exception;
1211

1312
/**
14-
*
15-
* @category Zend
16-
* @package Zend_Application
1713
*/
1814
class InitializationException extends RuntimeException
1915
{}

src/Client/Adapter/Exception/InvalidArgumentException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter\Exception;
1211

1312
use Zend\Http\Client\Exception;
1413

1514
/**
16-
*
17-
* @category Zend
18-
* @package Zend_Application
1915
*/
2016
class InvalidArgumentException extends Exception\InvalidArgumentException implements
2117
ExceptionInterface

src/Client/Adapter/Exception/OutOfRangeException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter\Exception;
1211

1312
use Zend\Http\Client\Exception;
1413

1514
/**
16-
*
17-
* @category Zend
18-
* @package Zend_Application
1915
*/
2016
class OutOfRangeException extends Exception\OutOfRangeException implements
2117
ExceptionInterface

src/Client/Adapter/Exception/RuntimeException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter\Exception;
1211

1312
use Zend\Http\Client\Exception;
1413

1514
/**
16-
*
17-
* @category Zend
18-
* @package Zend_Application
1915
*/
2016
class RuntimeException extends Exception\RuntimeException implements
2117
ExceptionInterface

src/Client/Adapter/Exception/TimeoutException.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
66
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
8-
* @package Zend_Http
98
*/
109

1110
namespace Zend\Http\Client\Adapter\Exception;
1211

1312
/**
14-
*
15-
* @category Zend
16-
* @package Zend_Application
1713
*/
1814
class TimeoutException extends RuntimeException implements ExceptionInterface
1915
{

0 commit comments

Comments
 (0)