summaryrefslogtreecommitdiff
path: root/server/vendor/guzzlehttp/guzzle/src
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-28 12:17:43 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-28 12:17:43 +0200
commit53f65de9d4163c9c095f2b8e87baca648c3645bd (patch)
tree37f167f38b25aa50bd7dd1429438c0245a280a28 /server/vendor/guzzlehttp/guzzle/src
parent60cfe3ebc039df8d6a468a43a59e7fd8c2a16956 (diff)
parent804fa322d841d73ee7592885ec500dc94e91b9e6 (diff)
Test
Diffstat (limited to 'server/vendor/guzzlehttp/guzzle/src')
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Client.php9
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/ClientInterface.php10
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php18
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php9
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php3
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php2
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php5
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php2
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php7
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/Middleware.php7
-rwxr-xr-xserver/vendor/guzzlehttp/guzzle/src/functions.php46
11 files changed, 87 insertions, 31 deletions
diff --git a/server/vendor/guzzlehttp/guzzle/src/Client.php b/server/vendor/guzzlehttp/guzzle/src/Client.php
index 2e86ece..9f7b0cf 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Client.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Client.php
@@ -93,7 +93,7 @@ class Client implements ClientInterface
$options = $this->prepareDefaults($options);
return $this->transfer(
- $request->withUri($this->buildUri($request->getUri(), $options)),
+ $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')),
$options
);
}
@@ -173,7 +173,7 @@ class Client implements ClientInterface
$cleanedNoProxy = str_replace(' ', '', $noProxy);
$defaults['proxy']['no'] = explode(',', $cleanedNoProxy);
}
-
+
$this->config = $config + $defaults;
if (!empty($config['cookies']) && $config['cookies'] === true) {
@@ -291,7 +291,7 @@ class Client implements ClientInterface
. 'x-www-form-urlencoded requests, and the multipart '
. 'option to send multipart/form-data requests.');
}
- $options['body'] = http_build_query($options['form_params'], null, '&');
+ $options['body'] = http_build_query($options['form_params'], '', '&');
unset($options['form_params']);
$options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
}
@@ -357,7 +357,8 @@ class Client implements ClientInterface
}
if (isset($options['json'])) {
- $modify['body'] = Psr7\stream_for(json_encode($options['json']));
+ $jsonStr = \GuzzleHttp\json_encode($options['json']);
+ $modify['body'] = Psr7\stream_for($jsonStr);
$options['_conditional']['Content-Type'] = 'application/json';
unset($options['json']);
}
diff --git a/server/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/server/vendor/guzzlehttp/guzzle/src/ClientInterface.php
index 19068e1..5222dab 100755
--- a/server/vendor/guzzlehttp/guzzle/src/ClientInterface.php
+++ b/server/vendor/guzzlehttp/guzzle/src/ClientInterface.php
@@ -12,7 +12,7 @@ use Psr\Http\Message\UriInterface;
*/
interface ClientInterface
{
- const VERSION = '6.1.1';
+ const VERSION = '6.2.0';
/**
* Send an HTTP request.
@@ -44,14 +44,14 @@ interface ClientInterface
* relative path to append to the base path of the client. The URL can
* contain the query string as well.
*
- * @param string $method HTTP method
- * @param string|UriInterface $uri URI object or string.
- * @param array $options Request options to apply.
+ * @param string $method HTTP method.
+ * @param string|UriInterface|null $uri URI object or string (default null).
+ * @param array $options Request options to apply.
*
* @return ResponseInterface
* @throws GuzzleException
*/
- public function request($method, $uri, array $options = []);
+ public function request($method, $uri = null, array $options = []);
/**
* Create and send an asynchronous HTTP request.
diff --git a/server/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/server/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
index 11421fe..0b932ae 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
@@ -5,7 +5,7 @@ use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
- * Cookie jar that stores cookies an an array
+ * Cookie jar that stores cookies as an array
*/
class CookieJar implements CookieJarInterface
{
@@ -58,22 +58,10 @@ class CookieJar implements CookieJarInterface
}
/**
- * Quote the cookie value if it is not already quoted and it contains
- * problematic characters.
- *
- * @param string $value Value that may or may not need to be quoted
- *
- * @return string
+ * @deprecated
*/
public static function getCookieValue($value)
{
- if (substr($value, 0, 1) !== '"' &&
- substr($value, -1, 1) !== '"' &&
- strpbrk($value, ';,=')
- ) {
- $value = '"' . $value . '"';
- }
-
return $value;
}
@@ -248,7 +236,7 @@ class CookieJar implements CookieJarInterface
(!$cookie->getSecure() || $scheme == 'https')
) {
$values[] = $cookie->getName() . '='
- . self::getCookieValue($cookie->getValue());
+ . $cookie->getValue();
}
}
diff --git a/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
index e4e6248..9887c1d 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
@@ -11,7 +11,7 @@ class FileCookieJar extends CookieJar
/** @var bool Control whether to persist session cookies or not. */
private $storeSessionCookies;
-
+
/**
* Create a new FileCookieJar object
*
@@ -55,7 +55,8 @@ class FileCookieJar extends CookieJar
}
}
- if (false === file_put_contents($filename, json_encode($json))) {
+ $jsonStr = \GuzzleHttp\json_encode($json);
+ if (false === file_put_contents($filename, $jsonStr)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}
@@ -73,9 +74,11 @@ class FileCookieJar extends CookieJar
$json = file_get_contents($filename);
if (false === $json) {
throw new \RuntimeException("Unable to load file {$filename}");
+ } elseif ($json === '') {
+ return;
}
- $data = json_decode($json, true);
+ $data = \GuzzleHttp\json_decode($json, true);
if (is_array($data)) {
foreach (json_decode($json, true) as $cookie) {
$this->setCookie(new SetCookie($cookie));
diff --git a/server/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/server/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
index e8d9388..1091899 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
@@ -265,6 +265,9 @@ class CurlFactory implements CurlFactoryInterface
$this->removeHeader('Content-Length', $conf);
}
$body = $request->getBody();
+ if ($body->isSeekable()) {
+ $body->rewind();
+ }
$conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) {
return $body->read($length);
};
diff --git a/server/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/server/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
index 417850b..945d06e 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
@@ -192,6 +192,6 @@ class CurlMultiHandler
}
}
- return max(0, $currentTime - $nextTime);
+ return max(0, $nextTime - $currentTime) * 1000000;
}
}
diff --git a/server/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/server/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
index c4b927e..7754e91 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
@@ -56,8 +56,13 @@ final class EasyHandle
if (!empty($this->options['decode_content'])
&& isset($normalizedKeys['content-encoding'])
) {
+ $headers['x-encoded-content-encoding']
+ = $headers[$normalizedKeys['content-encoding']];
unset($headers[$normalizedKeys['content-encoding']]);
if (isset($normalizedKeys['content-length'])) {
+ $headers['x-encoded-content-length']
+ = $headers[$normalizedKeys['content-length']];
+
$bodyLength = (int) $this->sink->getSize();
if ($bodyLength) {
$headers[$normalizedKeys['content-length']] = $bodyLength;
diff --git a/server/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/server/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
index cd7898f..0658769 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
@@ -74,7 +74,7 @@ class MockHandler implements \Countable
$response = array_shift($this->queue);
if (is_callable($response)) {
- $response = $response($request, $options);
+ $response = call_user_func($response, $request, $options);
}
$response = $response instanceof \Exception
diff --git a/server/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/server/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
index c835dc7..9f9c05f 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
@@ -138,7 +138,7 @@ class StreamHandler
: fopen('php://temp', 'r+');
return is_string($sink)
- ? new Psr7\Stream(Psr7\try_fopen($sink, 'r+'))
+ ? new Psr7\LazyOpenStream($sink, 'w+')
: Psr7\stream_for($sink);
}
@@ -153,10 +153,15 @@ class StreamHandler
$stream = new Psr7\InflateStream(
Psr7\stream_for($stream)
);
+ $headers['x-encoded-content-encoding']
+ = $headers[$normalizedKeys['content-encoding']];
// Remove content-encoding header
unset($headers[$normalizedKeys['content-encoding']]);
// Fix content-length header
if (isset($normalizedKeys['content-length'])) {
+ $headers['x-encoded-content-length']
+ = $headers[$normalizedKeys['content-length']];
+
$length = (int) $stream->getSize();
if ($length == 0) {
unset($headers[$normalizedKeys['content-length']]);
diff --git a/server/vendor/guzzlehttp/guzzle/src/Middleware.php b/server/vendor/guzzlehttp/guzzle/src/Middleware.php
index 85d3165..449ab4b 100755
--- a/server/vendor/guzzlehttp/guzzle/src/Middleware.php
+++ b/server/vendor/guzzlehttp/guzzle/src/Middleware.php
@@ -75,9 +75,14 @@ final class Middleware
* @param array $container Container to hold the history (by reference).
*
* @return callable Returns a function that accepts the next handler.
+ * @throws \InvalidArgumentException if container is not an array or ArrayAccess.
*/
- public static function history(array &$container)
+ public static function history(&$container)
{
+ if (!is_array($container) && !$container instanceof \ArrayAccess) {
+ throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess');
+ }
+
return function (callable $handler) use (&$container) {
return function ($request, array $options) use ($handler, &$container) {
return $handler($request, $options)->then(
diff --git a/server/vendor/guzzlehttp/guzzle/src/functions.php b/server/vendor/guzzlehttp/guzzle/src/functions.php
index 5e93b22..5ab82af 100755
--- a/server/vendor/guzzlehttp/guzzle/src/functions.php
+++ b/server/vendor/guzzlehttp/guzzle/src/functions.php
@@ -282,3 +282,49 @@ function is_host_in_noproxy($host, array $noProxyArray)
return false;
}
+
+/**
+ * Wrapper for json_decode that throws when an error occurs.
+ *
+ * @param string $json JSON data to parse
+ * @param bool $assoc When true, returned objects will be converted
+ * into associative arrays.
+ * @param int $depth User specified recursion depth.
+ * @param int $options Bitmask of JSON decode options.
+ *
+ * @return mixed
+ * @throws \InvalidArgumentException if the JSON cannot be decoded.
+ * @link http://www.php.net/manual/en/function.json-decode.php
+ */
+function json_decode($json, $assoc = false, $depth = 512, $options = 0)
+{
+ $data = \json_decode($json, $assoc, $depth, $options);
+ if (JSON_ERROR_NONE !== json_last_error()) {
+ throw new \InvalidArgumentException(
+ 'json_decode error: ' . json_last_error_msg());
+ }
+
+ return $data;
+}
+
+/**
+ * Wrapper for JSON encoding that throws when an error occurs.
+ *
+ * @param string $value The value being encoded
+ * @param int $options JSON encode option bitmask
+ * @param int $depth Set the maximum depth. Must be greater than zero.
+ *
+ * @return string
+ * @throws \InvalidArgumentException if the JSON cannot be encoded.
+ * @link http://www.php.net/manual/en/function.json-encode.php
+ */
+function json_encode($value, $options = 0, $depth = 512)
+{
+ $json = \json_encode($value, $options, $depth);
+ if (JSON_ERROR_NONE !== json_last_error()) {
+ throw new \InvalidArgumentException(
+ 'json_encode error: ' . json_last_error_msg());
+ }
+
+ return $json;
+}