diff options
| author | EoleDev <EoleDev@outlook.fr> | 2016-03-23 15:30:47 +0100 |
|---|---|---|
| committer | EoleDev <EoleDev@outlook.fr> | 2016-03-23 15:30:47 +0100 |
| commit | 54ec6723deb44e325782afd366eeec01ee29ac55 (patch) | |
| tree | 5431400d307754a02e6c40b35a40e6761d7dac0c /server/vendor/guzzlehttp/guzzle | |
| parent | 0dc17aa9efb987dcdf6f864f4110450bcc0c9003 (diff) | |
Maj Library
Diffstat (limited to 'server/vendor/guzzlehttp/guzzle')
16 files changed, 111 insertions, 35 deletions
diff --git a/server/vendor/guzzlehttp/guzzle/.travis.yml b/server/vendor/guzzlehttp/guzzle/.travis.yml index d2060f4..a4cd64c 100644 --- a/server/vendor/guzzlehttp/guzzle/.travis.yml +++ b/server/vendor/guzzlehttp/guzzle/.travis.yml @@ -14,16 +14,17 @@ before_script: - composer install --no-interaction --prefer-source --dev - ~/.nvm/nvm.sh install v0.6.14 - ~/.nvm/nvm.sh run v0.6.14 + - '[ "$TRAVIS_PHP_VERSION" != "7.0" ] || echo "xdebug.overload_var_dump = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini' script: make test matrix: allow_failures: - php: hhvm - - php: 7.0 fast_finish: true before_deploy: + - rvm 1.9.3 do gem install mime-types -v 2.6.2 - make package deploy: diff --git a/server/vendor/guzzlehttp/guzzle/CHANGELOG.md b/server/vendor/guzzlehttp/guzzle/CHANGELOG.md index 5b7669b..5c35854 100644 --- a/server/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/server/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -1,5 +1,24 @@ # CHANGELOG +## 6.2.0 - 2016-03-21 + +* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`. + https://github.com/guzzle/guzzle/pull/1389 +* Bug fix: Fix sleep calculation when waiting for delayed requests. + https://github.com/guzzle/guzzle/pull/1324 +* Feature: More flexible history containers. + https://github.com/guzzle/guzzle/pull/1373 +* Bug fix: defer sink stream opening in StreamHandler. + https://github.com/guzzle/guzzle/pull/1377 +* Bug fix: do not attempt to escape cookie values. + https://github.com/guzzle/guzzle/pull/1406 +* Feature: report original content encoding and length on decoded responses. + https://github.com/guzzle/guzzle/pull/1409 +* Bug fix: rewind seekable request bodies before dispatching to cURL. + https://github.com/guzzle/guzzle/pull/1422 +* Bug fix: provide an empty string to `http_build_query` for HHVM workaround. + https://github.com/guzzle/guzzle/pull/1367 + ## 6.1.1 - 2015-11-22 * Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler diff --git a/server/vendor/guzzlehttp/guzzle/LICENSE b/server/vendor/guzzlehttp/guzzle/LICENSE index 9af9fba..ea7f07c 100644 --- a/server/vendor/guzzlehttp/guzzle/LICENSE +++ b/server/vendor/guzzlehttp/guzzle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2015 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com> +Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/server/vendor/guzzlehttp/guzzle/README.md b/server/vendor/guzzlehttp/guzzle/README.md index 3af1cc3..06e9497 100644 --- a/server/vendor/guzzlehttp/guzzle/README.md +++ b/server/vendor/guzzlehttp/guzzle/README.md @@ -24,7 +24,7 @@ $res = $client->request('GET', 'https://api.github.com/user', [ ]); echo $res->getStatusCode(); // 200 -echo $res->getHeader('content-type'); +echo $res->getHeaderLine('content-type'); // 'application/json; charset=utf8' echo $res->getBody(); // {"type":"User"...' diff --git a/server/vendor/guzzlehttp/guzzle/composer.json b/server/vendor/guzzlehttp/guzzle/composer.json index 1f8b070..f543372 100644 --- a/server/vendor/guzzlehttp/guzzle/composer.json +++ b/server/vendor/guzzlehttp/guzzle/composer.json @@ -35,7 +35,7 @@ }, "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "6.2-dev" } } } diff --git a/server/vendor/guzzlehttp/guzzle/src/Client.php b/server/vendor/guzzlehttp/guzzle/src/Client.php index 2e86ece..9f7b0cf 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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 100644 --- 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; +} |
