diff options
Diffstat (limited to 'vendor/sabre/http/lib')
-rw-r--r-- | vendor/sabre/http/lib/Auth/AWS.php | 16 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Auth/Digest.php | 6 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Client.php | 15 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Request.php | 1 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Response.php | 3 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Sapi.php | 24 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Version.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/functions.php | 17 |
8 files changed, 41 insertions, 43 deletions
diff --git a/vendor/sabre/http/lib/Auth/AWS.php b/vendor/sabre/http/lib/Auth/AWS.php index ffda3cf15..2690c634d 100644 --- a/vendor/sabre/http/lib/Auth/AWS.php +++ b/vendor/sabre/http/lib/Auth/AWS.php @@ -22,14 +22,14 @@ class AWS extends AbstractAuth * * @var string */ - private $signature = null; + private $signature; /** * The accesskey supplied by the HTTP client. * * @var string */ - private $accessKey = null; + private $accessKey; /** * An error code, if any. @@ -40,11 +40,11 @@ class AWS extends AbstractAuth */ public $errorCode = 0; - const ERR_NOAWSHEADER = 1; - const ERR_MD5CHECKSUMWRONG = 2; - const ERR_INVALIDDATEFORMAT = 3; - const ERR_REQUESTTIMESKEWED = 4; - const ERR_INVALIDSIGNATURE = 5; + public const ERR_NOAWSHEADER = 1; + public const ERR_MD5CHECKSUMWRONG = 2; + public const ERR_INVALIDDATEFORMAT = 3; + public const ERR_REQUESTTIMESKEWED = 4; + public const ERR_INVALIDSIGNATURE = 5; /** * Gathers all information from the headers. @@ -212,7 +212,7 @@ class AWS extends AbstractAuth } $key = str_pad($key, $blocksize, chr(0x00)); $ipad = str_repeat(chr(0x36), $blocksize); - $opad = str_repeat(chr(0x5c), $blocksize); + $opad = str_repeat(chr(0x5C), $blocksize); $hmac = pack('H*', sha1(($key ^ $opad).pack('H*', sha1(($key ^ $ipad).$message)))); return $hmac; diff --git a/vendor/sabre/http/lib/Auth/Digest.php b/vendor/sabre/http/lib/Auth/Digest.php index e80e78305..08fa34f90 100644 --- a/vendor/sabre/http/lib/Auth/Digest.php +++ b/vendor/sabre/http/lib/Auth/Digest.php @@ -34,8 +34,8 @@ class Digest extends AbstractAuth /** * These constants are used in setQOP();. */ - const QOP_AUTH = 1; - const QOP_AUTHINT = 2; + public const QOP_AUTH = 1; + public const QOP_AUTHINT = 2; protected $nonce; protected $opaque; @@ -177,8 +177,6 @@ class Digest extends AbstractAuth * It should be compatible with mod_php format and other webservers. * * If the header could not be found, null will be returned - * - * @return mixed */ public function getDigest() { diff --git a/vendor/sabre/http/lib/Client.php b/vendor/sabre/http/lib/Client.php index 2bc7483a7..c00f9e1b1 100644 --- a/vendor/sabre/http/lib/Client.php +++ b/vendor/sabre/http/lib/Client.php @@ -175,7 +175,7 @@ class Client extends EventEmitter * After calling sendAsync, you must therefore occasionally call the poll() * method, or wait(). */ - public function sendAsync(RequestInterface $request, callable $success = null, callable $error = null) + public function sendAsync(RequestInterface $request, ?callable $success = null, ?callable $error = null) { $this->emit('beforeRequest', [$request]); $this->sendAsyncInternal($request, $success, $error); @@ -299,8 +299,6 @@ class Client extends EventEmitter * Adds a CURL setting. * * These settings will be included in every HTTP request. - * - * @param mixed $value */ public function addCurlSetting(int $name, $value) { @@ -402,7 +400,10 @@ class Client extends EventEmitter $nHeaders[] = $key.': '.$value; } } - $settings[CURLOPT_HTTPHEADER] = $nHeaders; + + if ([] !== $nHeaders) { + $settings[CURLOPT_HTTPHEADER] = $nHeaders; + } $settings[CURLOPT_URL] = $request->getUrl(); // FIXME: CURLOPT_PROTOCOLS is currently unsupported by HHVM if (defined('CURLOPT_PROTOCOLS')) { @@ -416,9 +417,9 @@ class Client extends EventEmitter return $settings; } - const STATUS_SUCCESS = 0; - const STATUS_CURLERROR = 1; - const STATUS_HTTPERROR = 2; + public const STATUS_SUCCESS = 0; + public const STATUS_CURLERROR = 1; + public const STATUS_HTTPERROR = 2; private function parseResponse(string $response, $curlHandle): array { diff --git a/vendor/sabre/http/lib/Request.php b/vendor/sabre/http/lib/Request.php index b8395ff45..99a13d25a 100644 --- a/vendor/sabre/http/lib/Request.php +++ b/vendor/sabre/http/lib/Request.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Sabre\HTTP; -use LogicException; use Sabre\Uri; /** diff --git a/vendor/sabre/http/lib/Response.php b/vendor/sabre/http/lib/Response.php index c06c9637e..78ebb220d 100644 --- a/vendor/sabre/http/lib/Response.php +++ b/vendor/sabre/http/lib/Response.php @@ -100,10 +100,9 @@ class Response extends Message implements ResponseInterface * Creates the response object. * * @param string|int $status - * @param array $headers * @param resource $body */ - public function __construct($status = 500, array $headers = null, $body = null) + public function __construct($status = 500, ?array $headers = null, $body = null) { if (null !== $status) { $this->setStatus($status); diff --git a/vendor/sabre/http/lib/Sapi.php b/vendor/sabre/http/lib/Sapi.php index f8e8397fc..4c8fb6732 100644 --- a/vendor/sabre/http/lib/Sapi.php +++ b/vendor/sabre/http/lib/Sapi.php @@ -4,8 +4,6 @@ declare(strict_types=1); namespace Sabre\HTTP; -use InvalidArgumentException; - /** * PHP SAPI. * @@ -115,6 +113,12 @@ class Sapi if ($copied <= 0) { break; } + // Abort on client disconnect. + // With ignore_user_abort(true), the script is not aborted on client disconnect. + // To avoid reading the entire stream and dismissing the data afterward, check between the chunks if the client is still there. + if (1 === ignore_user_abort() && 1 === connection_aborted()) { + break; + } $left -= $copied; } } else { @@ -162,7 +166,7 @@ class Sapi $url = $value; break; - // These sometimes show up without a HTTP_ prefix + // These sometimes show up without a HTTP_ prefix case 'CONTENT_TYPE': $headers['Content-Type'] = $value; break; @@ -170,21 +174,21 @@ class Sapi $headers['Content-Length'] = $value; break; - // mod_php on apache will put credentials in these variables. - // (fast)cgi does not usually do this, however. + // mod_php on apache will put credentials in these variables. + // (fast)cgi does not usually do this, however. case 'PHP_AUTH_USER': if (isset($serverArray['PHP_AUTH_PW'])) { $headers['Authorization'] = 'Basic '.base64_encode($value.':'.$serverArray['PHP_AUTH_PW']); } break; - // Similarly, mod_php may also screw around with digest auth. + // Similarly, mod_php may also screw around with digest auth. case 'PHP_AUTH_DIGEST': $headers['Authorization'] = 'Digest '.$value; break; - // Apache may prefix the HTTP_AUTHORIZATION header with - // REDIRECT_, if mod_rewrite was used. + // Apache may prefix the HTTP_AUTHORIZATION header with + // REDIRECT_, if mod_rewrite was used. case 'REDIRECT_HTTP_AUTHORIZATION': $headers['Authorization'] = $value; break; @@ -220,11 +224,11 @@ class Sapi } if (null === $url) { - throw new InvalidArgumentException('The _SERVER array must have a REQUEST_URI key'); + throw new \InvalidArgumentException('The _SERVER array must have a REQUEST_URI key'); } if (null === $method) { - throw new InvalidArgumentException('The _SERVER array must have a REQUEST_METHOD key'); + throw new \InvalidArgumentException('The _SERVER array must have a REQUEST_METHOD key'); } $r = new Request($method, $url, $headers); $r->setHttpVersion($httpVersion); diff --git a/vendor/sabre/http/lib/Version.php b/vendor/sabre/http/lib/Version.php index 47582f22e..4ac82f6d7 100644 --- a/vendor/sabre/http/lib/Version.php +++ b/vendor/sabre/http/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '5.1.6'; + public const VERSION = '5.1.12'; } diff --git a/vendor/sabre/http/lib/functions.php b/vendor/sabre/http/lib/functions.php index d0477d943..9ecc1758a 100644 --- a/vendor/sabre/http/lib/functions.php +++ b/vendor/sabre/http/lib/functions.php @@ -4,9 +4,6 @@ declare(strict_types=1); namespace Sabre\HTTP; -use DateTime; -use InvalidArgumentException; - /** * A collection of useful helpers for parsing or generating various HTTP * headers. @@ -29,7 +26,7 @@ use InvalidArgumentException; * See: * http://tools.ietf.org/html/rfc7231#section-7.1.1.1 * - * @return bool|DateTime + * @return bool|\DateTime */ function parseDate(string $dateString) { @@ -65,7 +62,7 @@ function parseDate(string $dateString) } try { - return new DateTime($dateString, new \DateTimeZone('UTC')); + return new \DateTime($dateString, new \DateTimeZone('UTC')); } catch (\Exception $e) { return false; } @@ -74,7 +71,7 @@ function parseDate(string $dateString) /** * Transforms a DateTime object to a valid HTTP/1.1 Date header value. */ -function toDate(DateTime $dateTime): string +function toDate(\DateTime $dateTime): string { // We need to clone it, as we don't want to affect the existing // DateTime. @@ -171,9 +168,9 @@ function negotiateContentType($acceptHeaderValue, array $availableOptions) // Does this entry win? if ( - ($proposal['quality'] > $lastQuality) || - ($proposal['quality'] === $lastQuality && $specificity > $lastSpecificity) || - ($proposal['quality'] === $lastQuality && $specificity === $lastSpecificity && $optionIndex < $lastOptionIndex) + ($proposal['quality'] > $lastQuality) + || ($proposal['quality'] === $lastQuality && $specificity > $lastSpecificity) + || ($proposal['quality'] === $lastQuality && $specificity === $lastSpecificity && $optionIndex < $lastOptionIndex) ) { $lastQuality = $proposal['quality']; $lastSpecificity = $specificity; @@ -331,7 +328,7 @@ function parseMimeType(string $str): array if (2 !== count($mimeType)) { // Illegal value var_dump($mimeType); - exit(); + exit; // throw new InvalidArgumentException('Not a valid mime-type: '.$str); } list($type, $subType) = $mimeType; |