diff options
Diffstat (limited to 'vendor/sabre/http')
-rw-r--r-- | vendor/sabre/http/.github/workflows/ci.yml | 5 | ||||
-rw-r--r-- | vendor/sabre/http/CHANGELOG.md | 23 | ||||
-rw-r--r-- | vendor/sabre/http/README.md | 42 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Auth/AbstractAuth.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Auth/Basic.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Auth/Bearer.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Auth/Digest.php | 4 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Client.php | 4 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Message.php | 6 | ||||
-rw-r--r-- | vendor/sabre/http/lib/MessageDecoratorTrait.php | 6 | ||||
-rw-r--r-- | vendor/sabre/http/lib/MessageInterface.php | 10 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Request.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/RequestDecorator.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/RequestInterface.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Response.php | 4 | ||||
-rw-r--r-- | vendor/sabre/http/lib/ResponseDecorator.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/ResponseInterface.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Sapi.php | 62 | ||||
-rw-r--r-- | vendor/sabre/http/lib/Version.php | 2 | ||||
-rw-r--r-- | vendor/sabre/http/lib/functions.php | 8 |
20 files changed, 93 insertions, 99 deletions
diff --git a/vendor/sabre/http/.github/workflows/ci.yml b/vendor/sabre/http/.github/workflows/ci.yml index cbb681e53..91b509bf0 100644 --- a/vendor/sabre/http/.github/workflows/ci.yml +++ b/vendor/sabre/http/.github/workflows/ci.yml @@ -13,10 +13,11 @@ jobs: fail-fast: false matrix: php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] - coverage: ['xdebug'] + coverage: ['pcov'] code-analysis: ['no'] include: - php-versions: '7.1' + coverage: 'none' code-analysis: 'yes' steps: - name: Checkout @@ -26,7 +27,7 @@ jobs: uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php with: php-version: ${{ matrix.php-versions }} - extensions: ctype, curl, mbstring, xdebug + extensions: ctype, curl, mbstring coverage: ${{ matrix.coverage }} tools: composer diff --git a/vendor/sabre/http/CHANGELOG.md b/vendor/sabre/http/CHANGELOG.md index 2dddce4fb..4db8cc772 100644 --- a/vendor/sabre/http/CHANGELOG.md +++ b/vendor/sabre/http/CHANGELOG.md @@ -1,23 +1,6 @@ ChangeLog ========= -5.1.6 (2022-07-15) ------------------- - -* #187 Allow testSendToGetLargeContent peak memory usage to be specified externally (@phil-davis) -* #188 Fix various small typos and grammar (@phil-davis) -* #189 Fix typo in text of status code 203 'Non-Authoritative Information' (@phil-davis) - -5.1.5 (2022-07-09) ------------------- - -* #184 Remove 4GB file size workaround for 32bit OS / Stream Videos on IOS (@schoetju) - -5.1.4 (2022-06-24) ------------------- - -* #182 Fix encoding detection on PHP 8.1 (@come-nc) - 5.1.3 (2021-11-04) ------------------ @@ -89,7 +72,7 @@ ChangeLog * #65: It's now possible to supply request/response bodies using a callback functions. This allows very high-speed/low-memory responses to be created. (@petrkotek). -* Strict typing is used everywhere this is applicable. +* Strict typing is used every where this is applicable. * Removed `URLUtil` class. It was deprecated a long time ago, and most of its functions moved to the `sabre/uri` package. * Removed `Util` class. Most of its functions moved to the `functions.php` @@ -108,7 +91,7 @@ ChangeLog 4.2.3 (2017-06-12) ------------------ -* #74, #77: Work around 4GB file size limit at 32-Bit systems +* #74, #77: Work around 4GB file size limit at 32 Bit systems 4.2.2 (2017-01-02) @@ -296,7 +279,7 @@ ChangeLog * Changed: Response::send() is now Sapi::sendResponse($response). * Changed: Request::createFromPHPRequest is now Sapi::getRequest(). * Changed: Message::getBodyAsStream and Message::getBodyAsString were added. The - existing Message::getBody changed its behavior, so be careful. + existing Message::getBody changed it's behavior, so be careful. 2.0.0alpha5 (2013-11-07) diff --git a/vendor/sabre/http/README.md b/vendor/sabre/http/README.md index 2f01c1448..8159b4d49 100644 --- a/vendor/sabre/http/README.md +++ b/vendor/sabre/http/README.md @@ -28,11 +28,11 @@ The objects are extendable and easily mockable. Build status ------------ -| branch | status | -|--------|---------------------------------------------------------------------------------------------------------------| +| branch | status | +| ------ | ------ | | master | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=master)](https://travis-ci.org/sabre-io/http) | -| 4.2 | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=4.2)](https://travis-ci.org/sabre-io/http) | -| 3.0 | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=3.0)](https://travis-ci.org/sabre-io/http) | +| 4.2 | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=4.2)](https://travis-ci.org/sabre-io/http) | +| 3.0 | [![Build Status](https://travis-ci.org/sabre-io/http.svg?branch=3.0)](https://travis-ci.org/sabre-io/http) | Installation ------------ @@ -84,7 +84,7 @@ $request = HTTP\Sapi::getRequest(); This line should only happen once in your entire application. Everywhere else you should pass this request object around using dependency injection. -You should always typehint on its interface: +You should always typehint on it's interface: ```php function handleRequest(HTTP\RequestInterface $request) { @@ -133,9 +133,9 @@ Simply extending Request and Response may pose some problems: 1. You may want to extend the objects with new behaviors differently, in different subsystems of your application, -2. The `Sapi::getRequest` factory always returns an instance of +2. The `Sapi::getRequest` factory always returns a instance of `Request` so you would have to override the factory method as well, -3. By controlling the instantiation and depend on specific `Request` and +3. By controlling the instantation and depend on specific `Request` and `Response` instances in your library or application, you make it harder to work with other applications which also use `sabre/http`. @@ -162,7 +162,7 @@ class MyRequest extends HTTP\RequestDecorator { Our application assumes that the true `Request` object was instantiated somewhere else, by some other subsystem. This could simply be a call like `$request = Sapi::getRequest()` at the top of your application, -but could also be somewhere in a unit test. +but could also be somewhere in a unittest. All we know in the current subsystem, is that we received a `$request` and that it implements `Sabre\HTTP\RequestInterface`. To decorate this object, @@ -296,7 +296,7 @@ $remoteUrl = 'http://example.org/'; // The url we're proxying from. Please note that this must be a relative url, // and basically acts as the base url. // -// If your $remoteUrl doesn't end with a slash, this one probably shouldn't +// If youre $remoteUrl doesn't end with a slash, this one probably shouldn't // either. $myBaseUrl = '/reverseproxy.php'; // $myBaseUrl = '/~evert/sabre/http/examples/reverseproxy.php/'; @@ -412,10 +412,10 @@ function setBaseUrl($url); * If the full path is equal to the base url, this method will return an * empty string. * - * This method will also urldecode the path, and if the url was encoded as + * This method will also urldecode the path, and if the url was incoded as * ISO-8859-1, it will convert it to UTF-8. * - * If the path is outside the base url, a LogicException will be thrown. + * If the path is outside of the base url, a LogicException will be thrown. * * @return string */ @@ -491,7 +491,7 @@ function getBodyAsStream(); function getBodyAsString(); /** - * Returns the message body, as its internal representation. + * Returns the message body, as it's internal representation. * * This could be either a string or a stream. * @@ -515,7 +515,7 @@ function setBody($body); function getHeaders(); /** - * Returns a specific HTTP header, based on its name. + * Returns a specific HTTP header, based on it's name. * * The name must be treated as case-insensitive. * @@ -529,7 +529,7 @@ function getHeader($name); /** * Updates a HTTP header. * - * The case-sensitivity of the name value must be retained as-is. + * The case-sensitity of the name value must be retained as-is. * * @param string $name * @param string $value @@ -561,7 +561,7 @@ function addHeaders(array $headers); /** * Removes a HTTP header. * - * The specified header name must be treated as case-insensitive. + * The specified header name must be treated as case-insenstive. * This method should return true if the header was successfully deleted, * and false if the header did not exist. * @@ -593,7 +593,7 @@ function getHttpVersion(); /** * Returns the current HTTP status. * - * This is the status-code as well as the human-readable string. + * This is the status-code as well as the human readable string. * * @return string */ @@ -602,7 +602,7 @@ function getStatus(); /** * Sets the HTTP status code. * - * This can be either the full HTTP status code with human-readable string, + * This can be either the full HTTP status code with human readable string, * for example: "403 I can't let you do that, Dave". * * Or just the code, in which case the appropriate default message will be @@ -635,7 +635,7 @@ function getBodyAsStream(); function getBodyAsString(); /** - * Returns the message body, as its internal representation. + * Returns the message body, as it's internal representation. * * This could be either a string or a stream. * @@ -660,7 +660,7 @@ function setBody($body); function getHeaders(); /** - * Returns a specific HTTP header, based on its name. + * Returns a specific HTTP header, based on it's name. * * The name must be treated as case-insensitive. * @@ -674,7 +674,7 @@ function getHeader($name); /** * Updates a HTTP header. * - * The case-sensitivity of the name value must be retained as-is. + * The case-sensitity of the name value must be retained as-is. * * @param string $name * @param string $value @@ -706,7 +706,7 @@ function addHeaders(array $headers); /** * Removes a HTTP header. * - * The specified header name must be treated as case-insensitive. + * The specified header name must be treated as case-insenstive. * This method should return true if the header was successfully deleted, * and false if the header did not exist. * diff --git a/vendor/sabre/http/lib/Auth/AbstractAuth.php b/vendor/sabre/http/lib/Auth/AbstractAuth.php index 07f451bc0..645f07edd 100644 --- a/vendor/sabre/http/lib/Auth/AbstractAuth.php +++ b/vendor/sabre/http/lib/Auth/AbstractAuth.php @@ -50,7 +50,7 @@ abstract class AbstractAuth } /** - * This method sends the needed HTTP header and status code (401) to force + * This method sends the needed HTTP header and statuscode (401) to force * the user to login. */ abstract public function requireLogin(); diff --git a/vendor/sabre/http/lib/Auth/Basic.php b/vendor/sabre/http/lib/Auth/Basic.php index c1bad1a5b..d04b4a811 100644 --- a/vendor/sabre/http/lib/Auth/Basic.php +++ b/vendor/sabre/http/lib/Auth/Basic.php @@ -49,7 +49,7 @@ class Basic extends AbstractAuth } /** - * This method sends the needed HTTP header and status code (401) to force + * This method sends the needed HTTP header and statuscode (401) to force * the user to login. */ public function requireLogin() diff --git a/vendor/sabre/http/lib/Auth/Bearer.php b/vendor/sabre/http/lib/Auth/Bearer.php index 580e23941..988bb29d2 100644 --- a/vendor/sabre/http/lib/Auth/Bearer.php +++ b/vendor/sabre/http/lib/Auth/Bearer.php @@ -42,7 +42,7 @@ class Bearer extends AbstractAuth } /** - * This method sends the needed HTTP header and status code (401) to force + * This method sends the needed HTTP header and statuscode (401) to force * authentication. */ public function requireLogin() diff --git a/vendor/sabre/http/lib/Auth/Digest.php b/vendor/sabre/http/lib/Auth/Digest.php index e80e78305..a093d8b75 100644 --- a/vendor/sabre/http/lib/Auth/Digest.php +++ b/vendor/sabre/http/lib/Auth/Digest.php @@ -133,7 +133,7 @@ class Digest extends AbstractAuth return false; } // We need to add an md5 of the entire request body to the A2 part of the hash - $body = $this->request->getBody(); + $body = $this->request->getBody($asString = true); $this->request->setBody($body); $A2 .= ':'.md5($body); } elseif (!($this->qop & self::QOP_AUTH)) { @@ -174,7 +174,7 @@ class Digest extends AbstractAuth /** * This method returns the full digest string. * - * It should be compatible with mod_php format and other webservers. + * It should be compatibile with mod_php format and other webservers. * * If the header could not be found, null will be returned * diff --git a/vendor/sabre/http/lib/Client.php b/vendor/sabre/http/lib/Client.php index 2bc7483a7..99ffcf8cb 100644 --- a/vendor/sabre/http/lib/Client.php +++ b/vendor/sabre/http/lib/Client.php @@ -26,7 +26,7 @@ use Sabre\Uri; * request before it's done, such as adding authentication headers. * * The afterRequest event will be emitted after the request is completed - * successfully. + * succesfully. * * If a HTTP error is returned (status code higher than 399) the error event is * triggered. It's possible using this event to retry the request, by setting @@ -53,7 +53,7 @@ class Client extends EventEmitter protected $curlSettings = []; /** - * Whether exceptions should be thrown when a HTTP error is returned. + * Wether or not exceptions should be thrown when a HTTP error is returned. * * @var bool */ diff --git a/vendor/sabre/http/lib/Message.php b/vendor/sabre/http/lib/Message.php index dc57ca903..6474f38d2 100644 --- a/vendor/sabre/http/lib/Message.php +++ b/vendor/sabre/http/lib/Message.php @@ -96,7 +96,7 @@ abstract class Message implements MessageInterface } /** - * Returns the message body, as its internal representation. + * Returns the message body, as it's internal representation. * * This could be either a string, a stream or a callback writing the body to php://output. * @@ -141,7 +141,7 @@ abstract class Message implements MessageInterface } /** - * Returns a specific HTTP header, based on its name. + * Returns a specific HTTP header, based on it's name. * * The name must be treated as case-insensitive. * If the header does not exist, this method must return null. @@ -172,7 +172,7 @@ abstract class Message implements MessageInterface * For every time the HTTP header appeared in the request or response, an * item will appear in the array. * - * If the header did not exist, this method will return an empty array. + * If the header did not exists, this method will return an empty array. * * @return string[] */ diff --git a/vendor/sabre/http/lib/MessageDecoratorTrait.php b/vendor/sabre/http/lib/MessageDecoratorTrait.php index 191ba0f74..6f49dadfc 100644 --- a/vendor/sabre/http/lib/MessageDecoratorTrait.php +++ b/vendor/sabre/http/lib/MessageDecoratorTrait.php @@ -51,7 +51,7 @@ trait MessageDecoratorTrait } /** - * Returns the message body, as its internal representation. + * Returns the message body, as it's internal representation. * * This could be either a string or a stream. * @@ -91,7 +91,7 @@ trait MessageDecoratorTrait } /** - * Returns a specific HTTP header, based on its name. + * Returns a specific HTTP header, based on it's name. * * The name must be treated as case-insensitive. * If the header does not exist, this method must return null. @@ -116,7 +116,7 @@ trait MessageDecoratorTrait * For every time the HTTP header appeared in the request or response, an * item will appear in the array. * - * If the header did not exist, this method will return an empty array. + * If the header did not exists, this method will return an empty array. */ public function getHeaderAsArray(string $name): array { diff --git a/vendor/sabre/http/lib/MessageInterface.php b/vendor/sabre/http/lib/MessageInterface.php index 4531654bc..8504f0f59 100644 --- a/vendor/sabre/http/lib/MessageInterface.php +++ b/vendor/sabre/http/lib/MessageInterface.php @@ -33,7 +33,7 @@ interface MessageInterface public function getBodyAsString(): string; /** - * Returns the message body, as its internal representation. + * Returns the message body, as it's internal representation. * * This could be either a string, a stream or a callback writing the body to php://output * @@ -61,7 +61,7 @@ interface MessageInterface public function hasHeader(string $name): bool; /** - * Returns a specific HTTP header, based on its name. + * Returns a specific HTTP header, based on it's name. * * The name must be treated as case-insensitive. * If the header does not exist, this method must return null. @@ -83,7 +83,7 @@ interface MessageInterface * For every time the HTTP header appeared in the request or response, an * item will appear in the array. * - * If the header did not exist, this method will return an empty array. + * If the header did not exists, this method will return an empty array. * * @return string[] */ @@ -92,7 +92,7 @@ interface MessageInterface /** * Updates a HTTP header. * - * The case-sensitivity of the name value must be retained as-is. + * The case-sensitity of the name value must be retained as-is. * * If the header already existed, it will be overwritten. * @@ -131,7 +131,7 @@ interface MessageInterface /** * Removes a HTTP header. * - * The specified header name must be treated as case-insensitive. + * The specified header name must be treated as case-insenstive. * This method should return true if the header was successfully deleted, * and false if the header did not exist. */ diff --git a/vendor/sabre/http/lib/Request.php b/vendor/sabre/http/lib/Request.php index b8395ff45..496629a5b 100644 --- a/vendor/sabre/http/lib/Request.php +++ b/vendor/sabre/http/lib/Request.php @@ -155,7 +155,7 @@ class Request extends Message implements RequestInterface * If the full path is equal to the base url, this method will return an * empty string. * - * This method will also urldecode the path, and if the url was encoded as + * This method will also urldecode the path, and if the url was incoded as * ISO-8859-1, it will convert it to UTF-8. * * If the path is outside of the base url, a LogicException will be thrown. diff --git a/vendor/sabre/http/lib/RequestDecorator.php b/vendor/sabre/http/lib/RequestDecorator.php index 23e790e7d..0ad24925f 100644 --- a/vendor/sabre/http/lib/RequestDecorator.php +++ b/vendor/sabre/http/lib/RequestDecorator.php @@ -104,7 +104,7 @@ class RequestDecorator implements RequestInterface * If the full path is equal to the base url, this method will return an * empty string. * - * This method will also urldecode the path, and if the url was encoded as + * This method will also urldecode the path, and if the url was incoded as * ISO-8859-1, it will convert it to UTF-8. * * If the path is outside of the base url, a LogicException will be thrown. diff --git a/vendor/sabre/http/lib/RequestInterface.php b/vendor/sabre/http/lib/RequestInterface.php index 5ec7777c6..83fa85bdc 100644 --- a/vendor/sabre/http/lib/RequestInterface.php +++ b/vendor/sabre/http/lib/RequestInterface.php @@ -67,7 +67,7 @@ interface RequestInterface extends MessageInterface * If the full path is equal to the base url, this method will return an * empty string. * - * This method will also urldecode the path, and if the url was encoded as + * This method will also urldecode the path, and if the url was incoded as * ISO-8859-1, it will convert it to UTF-8. * * If the path is outside of the base url, a LogicException will be thrown. diff --git a/vendor/sabre/http/lib/Response.php b/vendor/sabre/http/lib/Response.php index c06c9637e..2369bb41e 100644 --- a/vendor/sabre/http/lib/Response.php +++ b/vendor/sabre/http/lib/Response.php @@ -25,7 +25,7 @@ class Response extends Message implements ResponseInterface 200 => 'OK', 201 => 'Created', 202 => 'Accepted', - 203 => 'Non-Authoritative Information', + 203 => 'Non-Authorative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', @@ -137,7 +137,7 @@ class Response extends Message implements ResponseInterface /** * Sets the HTTP status code. * - * This can be either the full HTTP status code with human-readable string, + * This can be either the full HTTP status code with human readable string, * for example: "403 I can't let you do that, Dave". * * Or just the code, in which case the appropriate default message will be diff --git a/vendor/sabre/http/lib/ResponseDecorator.php b/vendor/sabre/http/lib/ResponseDecorator.php index 30b9ec0e5..5f9fe7c65 100644 --- a/vendor/sabre/http/lib/ResponseDecorator.php +++ b/vendor/sabre/http/lib/ResponseDecorator.php @@ -47,7 +47,7 @@ class ResponseDecorator implements ResponseInterface /** * Sets the HTTP status code. * - * This can be either the full HTTP status code with human-readable string, + * This can be either the full HTTP status code with human readable string, * for example: "403 I can't let you do that, Dave". * * Or just the code, in which case the appropriate default message will be diff --git a/vendor/sabre/http/lib/ResponseInterface.php b/vendor/sabre/http/lib/ResponseInterface.php index fd73d25cd..9bd93f179 100644 --- a/vendor/sabre/http/lib/ResponseInterface.php +++ b/vendor/sabre/http/lib/ResponseInterface.php @@ -28,7 +28,7 @@ interface ResponseInterface extends MessageInterface /** * Sets the HTTP status code. * - * This can be either the full HTTP status code with human-readable string, + * This can be either the full HTTP status code with human readable string, * for example: "403 I can't let you do that, Dave". * * Or just the code, in which case the appropriate default message will be diff --git a/vendor/sabre/http/lib/Sapi.php b/vendor/sabre/http/lib/Sapi.php index f8e8397fc..823d5df25 100644 --- a/vendor/sabre/http/lib/Sapi.php +++ b/vendor/sabre/http/lib/Sapi.php @@ -26,7 +26,7 @@ use InvalidArgumentException; * * php://output * * You can choose to either call all these methods statically, but you can also - * instantiate this as an object to allow for polymorphism. + * instantiate this as an object to allow for polymorhpism. * * @copyright Copyright (C) fruux GmbH (https://fruux.com/) * @author Evert Pot (http://evertpot.com/) @@ -89,33 +89,41 @@ class Sapi if (null !== $contentLength) { $output = fopen('php://output', 'wb'); if (is_resource($body) && 'stream' == get_resource_type($body)) { - // a workaround to make PHP more possible to use mmap based copy, see https://github.com/sabre-io/http/pull/119 - $left = (int) $contentLength; - // copy with 4MiB chunks - $chunk_size = 4 * 1024 * 1024; - stream_set_chunk_size($output, $chunk_size); - // If this is a partial response, flush the beginning bytes until the first position that is a multiple of the page size. - $contentRange = $response->getHeader('Content-Range'); - // Matching "Content-Range: bytes 1234-5678/7890" - if (null !== $contentRange && preg_match('/^bytes\s([0-9]+)-([0-9]+)\//i', $contentRange, $matches)) { - // 4kB should be the default page size on most architectures - $pageSize = 4096; - $offset = (int) $matches[1]; - $delta = ($offset % $pageSize) > 0 ? ($pageSize - $offset % $pageSize) : 0; - if ($delta > 0) { - $left -= stream_copy_to_stream($body, $output, min($delta, $left)); + if (PHP_INT_SIZE > 4) { + // use the dedicated function on 64 Bit systems + // a workaround to make PHP more possible to use mmap based copy, see https://github.com/sabre-io/http/pull/119 + $left = (int) $contentLength; + // copy with 4MiB chunks + $chunk_size = 4 * 1024 * 1024; + stream_set_chunk_size($output, $chunk_size); + // If this is a partial response, flush the beginning bytes until the first position that is a multiple of the page size. + $contentRange = $response->getHeader('Content-Range'); + // Matching "Content-Range: bytes 1234-5678/7890" + if (null !== $contentRange && preg_match('/^bytes\s([0-9]+)-([0-9]+)\//i', $contentRange, $matches)) { + // 4kB should be the default page size on most architectures + $pageSize = 4096; + $offset = (int) $matches[1]; + $delta = ($offset % $pageSize) > 0 ? ($pageSize - $offset % $pageSize) : 0; + if ($delta > 0) { + $left -= stream_copy_to_stream($body, $output, min($delta, $left)); + } } - } - while ($left > 0) { - $copied = stream_copy_to_stream($body, $output, min($left, $chunk_size)); - // stream_copy_to_stream($src, $dest, $maxLength) must return the number of bytes copied or false in case of failure - // But when the $maxLength is greater than the total number of bytes remaining in the stream, - // It returns the negative number of bytes copied - // So break the loop in such cases. - if ($copied <= 0) { - break; + while ($left > 0) { + $copied = stream_copy_to_stream($body, $output, min($left, $chunk_size)); + // stream_copy_to_stream($src, $dest, $maxLength) must return the number of bytes copied or false in case of failure + // But when the $maxLength is greater than the total number of bytes remaining in the stream, + // It returns the negative number of bytes copied + // So break the loop in such cases. + if ($copied <= 0) { + break; + } + $left -= $copied; + } + } else { + // workaround for 32 Bit systems to avoid stream_copy_to_stream + while (!feof($body)) { + fwrite($output, fread($body, 8192)); } - $left -= $copied; } } else { fwrite($output, $body, (int) $contentLength); @@ -207,7 +215,7 @@ class Sapi // Normalizing it to be prettier $header = strtolower(substr($key, 5)); - // Transforming dashes into spaces, and upper-casing + // Transforming dashes into spaces, and uppercasing // every first letter. $header = ucwords(str_replace('_', ' ', $header)); diff --git a/vendor/sabre/http/lib/Version.php b/vendor/sabre/http/lib/Version.php index 47582f22e..f182979c6 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'; + const VERSION = '5.1.3'; } diff --git a/vendor/sabre/http/lib/functions.php b/vendor/sabre/http/lib/functions.php index d0477d943..97673da46 100644 --- a/vendor/sabre/http/lib/functions.php +++ b/vendor/sabre/http/lib/functions.php @@ -349,7 +349,7 @@ function parseMimeType(string $str): array // The quality parameter, if it appears, also marks the end of // the parameter list. Anything after the q= counts as an // 'accept extension' and could introduce new semantics in - // content-negotiation. + // content-negotation. if ('q' !== $partName) { $parameters[$partName] = $part; } else { @@ -404,9 +404,11 @@ function decodePath(string $path): string function decodePathSegment(string $path): string { $path = rawurldecode($path); + $encoding = mb_detect_encoding($path, ['UTF-8', 'ISO-8859-1']); - if (!mb_check_encoding($path, 'UTF-8') && mb_check_encoding($path, 'ISO-8859-1')) { - $path = mb_convert_encoding($path, 'UTF-8', 'ISO-8859-1'); + switch ($encoding) { + case 'ISO-8859-1': + $path = utf8_encode($path); } return $path; |