Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
28
web/vendor/guzzlehttp/guzzle/src/Client.php
vendored
28
web/vendor/guzzlehttp/guzzle/src/Client.php
vendored
|
@ -9,18 +9,18 @@ use Psr\Http\Message\RequestInterface;
|
|||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* @method ResponseInterface get($uri, array $options = [])
|
||||
* @method ResponseInterface head($uri, array $options = [])
|
||||
* @method ResponseInterface put($uri, array $options = [])
|
||||
* @method ResponseInterface post($uri, array $options = [])
|
||||
* @method ResponseInterface patch($uri, array $options = [])
|
||||
* @method ResponseInterface delete($uri, array $options = [])
|
||||
* @method Promise\PromiseInterface getAsync($uri, array $options = [])
|
||||
* @method Promise\PromiseInterface headAsync($uri, array $options = [])
|
||||
* @method Promise\PromiseInterface putAsync($uri, array $options = [])
|
||||
* @method Promise\PromiseInterface postAsync($uri, array $options = [])
|
||||
* @method Promise\PromiseInterface patchAsync($uri, array $options = [])
|
||||
* @method Promise\PromiseInterface deleteAsync($uri, array $options = [])
|
||||
* @method ResponseInterface get(string|UriInterface $uri, array $options = [])
|
||||
* @method ResponseInterface head(string|UriInterface $uri, array $options = [])
|
||||
* @method ResponseInterface put(string|UriInterface $uri, array $options = [])
|
||||
* @method ResponseInterface post(string|UriInterface $uri, array $options = [])
|
||||
* @method ResponseInterface patch(string|UriInterface $uri, array $options = [])
|
||||
* @method ResponseInterface delete(string|UriInterface $uri, array $options = [])
|
||||
* @method Promise\PromiseInterface getAsync(string|UriInterface $uri, array $options = [])
|
||||
* @method Promise\PromiseInterface headAsync(string|UriInterface $uri, array $options = [])
|
||||
* @method Promise\PromiseInterface putAsync(string|UriInterface $uri, array $options = [])
|
||||
* @method Promise\PromiseInterface postAsync(string|UriInterface $uri, array $options = [])
|
||||
* @method Promise\PromiseInterface patchAsync(string|UriInterface $uri, array $options = [])
|
||||
* @method Promise\PromiseInterface deleteAsync(string|UriInterface $uri, array $options = [])
|
||||
*/
|
||||
class Client implements ClientInterface
|
||||
{
|
||||
|
@ -142,10 +142,10 @@ class Client implements ClientInterface
|
|||
$uri = Psr7\uri_for($uri === null ? '' : $uri);
|
||||
|
||||
if (isset($config['base_uri'])) {
|
||||
$uri = Psr7\Uri::resolve(Psr7\uri_for($config['base_uri']), $uri);
|
||||
$uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
|
||||
}
|
||||
|
||||
return $uri->getScheme() === '' ? $uri->withScheme('http') : $uri;
|
||||
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace GuzzleHttp\Exception;
|
|||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use GuzzleHttp\Promise\PromiseInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
/**
|
||||
* HTTP Request exception
|
||||
|
@ -89,12 +90,15 @@ class RequestException extends TransferException
|
|||
$className = __CLASS__;
|
||||
}
|
||||
|
||||
$uri = $request->getUri();
|
||||
$uri = static::obfuscateUri($uri);
|
||||
|
||||
// Server Error: `GET /` resulted in a `404 Not Found` response:
|
||||
// <html> ... (truncated)
|
||||
$message = sprintf(
|
||||
'%s: `%s` resulted in a `%s` response',
|
||||
$label,
|
||||
$request->getMethod() . ' ' . $request->getUri(),
|
||||
$request->getMethod() . ' ' . $uri,
|
||||
$response->getStatusCode() . ' ' . $response->getReasonPhrase()
|
||||
);
|
||||
|
||||
|
@ -141,6 +145,24 @@ class RequestException extends TransferException
|
|||
return $summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obfuscates URI if there is an username and a password present
|
||||
*
|
||||
* @param UriInterface $uri
|
||||
*
|
||||
* @return UriInterface
|
||||
*/
|
||||
private static function obfuscateUri($uri)
|
||||
{
|
||||
$userInfo = $uri->getUserInfo();
|
||||
|
||||
if (false !== ($pos = strpos($userInfo, ':'))) {
|
||||
return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the request that caused the exception
|
||||
*
|
||||
|
|
|
@ -210,7 +210,7 @@ class StreamHandler
|
|||
Psr7\copy_to_stream(
|
||||
$source,
|
||||
$sink,
|
||||
strlen($contentLength) > 0 ? (int) $contentLength : -1
|
||||
(strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1
|
||||
);
|
||||
|
||||
$sink->seek(0);
|
||||
|
|
|
@ -208,9 +208,9 @@ class RedirectMiddleware
|
|||
ResponseInterface $response,
|
||||
array $protocols
|
||||
) {
|
||||
$location = Psr7\Uri::resolve(
|
||||
$location = Psr7\UriResolver::resolve(
|
||||
$request->getUri(),
|
||||
$response->getHeaderLine('Location')
|
||||
new Psr7\Uri($response->getHeaderLine('Location'))
|
||||
);
|
||||
|
||||
// Ensure that the redirect URI is allowed based on the protocols.
|
||||
|
|
|
@ -43,8 +43,8 @@ final class RequestOptions
|
|||
const AUTH = 'auth';
|
||||
|
||||
/**
|
||||
* body: (string|null|callable|iterator|object) Body to send in the
|
||||
* request.
|
||||
* body: (resource|string|null|int|float|StreamInterface|callable|\Iterator)
|
||||
* Body to send in the request.
|
||||
*/
|
||||
const BODY = 'body';
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ use GuzzleHttp\Promise\PromiseInterface;
|
|||
use GuzzleHttp\Promise\RejectedPromise;
|
||||
use GuzzleHttp\Psr7;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Middleware that retries requests based on the boolean result of
|
||||
|
@ -25,8 +26,8 @@ class RetryMiddleware
|
|||
* retried.
|
||||
* @param callable $nextHandler Next handler to invoke.
|
||||
* @param callable $delay Function that accepts the number of retries
|
||||
* and returns the number of milliseconds to
|
||||
* delay.
|
||||
* and [response] and returns the number of
|
||||
* milliseconds to delay.
|
||||
*/
|
||||
public function __construct(
|
||||
callable $decider,
|
||||
|
@ -82,7 +83,7 @@ class RetryMiddleware
|
|||
)) {
|
||||
return $value;
|
||||
}
|
||||
return $this->doRetry($req, $options);
|
||||
return $this->doRetry($req, $options, $value);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -102,9 +103,9 @@ class RetryMiddleware
|
|||
};
|
||||
}
|
||||
|
||||
private function doRetry(RequestInterface $request, array $options)
|
||||
private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
|
||||
{
|
||||
$options['delay'] = call_user_func($this->delay, ++$options['retries']);
|
||||
$options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);
|
||||
|
||||
return $this($request, $options);
|
||||
}
|
||||
|
|
Reference in a new issue