Maj Library
This commit is contained in:
parent
0dc17aa9ef
commit
54ec6723de
72 changed files with 525 additions and 455 deletions
3
server/vendor/guzzlehttp/guzzle/.travis.yml
vendored
3
server/vendor/guzzlehttp/guzzle/.travis.yml
vendored
|
@ -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:
|
||||
|
|
19
server/vendor/guzzlehttp/guzzle/CHANGELOG.md
vendored
19
server/vendor/guzzlehttp/guzzle/CHANGELOG.md
vendored
|
@ -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
|
||||
|
|
2
server/vendor/guzzlehttp/guzzle/LICENSE
vendored
2
server/vendor/guzzlehttp/guzzle/LICENSE
vendored
|
@ -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
|
||||
|
|
2
server/vendor/guzzlehttp/guzzle/README.md
vendored
2
server/vendor/guzzlehttp/guzzle/README.md
vendored
|
@ -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"...'
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.1-dev"
|
||||
"dev-master": "6.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -192,6 +192,6 @@ class CurlMultiHandler
|
|||
}
|
||||
}
|
||||
|
||||
return max(0, $currentTime - $nextTime);
|
||||
return max(0, $nextTime - $currentTime) * 1000000;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']]);
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue