aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/http
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-11 18:34:03 +0000
committerMario <mario@mariovavti.com>2022-10-11 18:34:03 +0000
commit108a3efe0b6d37a7ed394a84c69b924ca727f17a (patch)
treeed9904767622d769fcee883d407310087ed7d57a /vendor/sabre/http
parentccd826f63a7a4c7e442fab8a70d9c4c84808b417 (diff)
downloadvolse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.tar.gz
volse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.tar.bz2
volse-hubzilla-108a3efe0b6d37a7ed394a84c69b924ca727f17a.zip
update composer libs
Diffstat (limited to 'vendor/sabre/http')
-rw-r--r--vendor/sabre/http/.github/workflows/ci.yml5
-rw-r--r--vendor/sabre/http/CHANGELOG.md23
-rw-r--r--vendor/sabre/http/README.md42
-rw-r--r--vendor/sabre/http/lib/Auth/AbstractAuth.php2
-rw-r--r--vendor/sabre/http/lib/Auth/Basic.php2
-rw-r--r--vendor/sabre/http/lib/Auth/Bearer.php2
-rw-r--r--vendor/sabre/http/lib/Auth/Digest.php4
-rw-r--r--vendor/sabre/http/lib/Client.php4
-rw-r--r--vendor/sabre/http/lib/Message.php6
-rw-r--r--vendor/sabre/http/lib/MessageDecoratorTrait.php6
-rw-r--r--vendor/sabre/http/lib/MessageInterface.php10
-rw-r--r--vendor/sabre/http/lib/Request.php2
-rw-r--r--vendor/sabre/http/lib/RequestDecorator.php2
-rw-r--r--vendor/sabre/http/lib/RequestInterface.php2
-rw-r--r--vendor/sabre/http/lib/Response.php4
-rw-r--r--vendor/sabre/http/lib/ResponseDecorator.php2
-rw-r--r--vendor/sabre/http/lib/ResponseInterface.php2
-rw-r--r--vendor/sabre/http/lib/Sapi.php62
-rw-r--r--vendor/sabre/http/lib/Version.php2
-rw-r--r--vendor/sabre/http/lib/functions.php8
20 files changed, 99 insertions, 93 deletions
diff --git a/vendor/sabre/http/.github/workflows/ci.yml b/vendor/sabre/http/.github/workflows/ci.yml
index 91b509bf0..cbb681e53 100644
--- a/vendor/sabre/http/.github/workflows/ci.yml
+++ b/vendor/sabre/http/.github/workflows/ci.yml
@@ -13,11 +13,10 @@ jobs:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
- coverage: ['pcov']
+ coverage: ['xdebug']
code-analysis: ['no']
include:
- php-versions: '7.1'
- coverage: 'none'
code-analysis: 'yes'
steps:
- name: Checkout
@@ -27,7 +26,7 @@ jobs:
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
- extensions: ctype, curl, mbstring
+ extensions: ctype, curl, mbstring, xdebug
coverage: ${{ matrix.coverage }}
tools: composer
diff --git a/vendor/sabre/http/CHANGELOG.md b/vendor/sabre/http/CHANGELOG.md
index 4db8cc772..2dddce4fb 100644
--- a/vendor/sabre/http/CHANGELOG.md
+++ b/vendor/sabre/http/CHANGELOG.md
@@ -1,6 +1,23 @@
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)
------------------
@@ -72,7 +89,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 every where this is applicable.
+* Strict typing is used everywhere 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`
@@ -91,7 +108,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)
@@ -279,7 +296,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 it's behavior, so be careful.
+ existing Message::getBody changed its 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 8159b4d49..2f01c1448 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 it's interface:
+You should always typehint on its 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 a instance of
+2. The `Sapi::getRequest` factory always returns an instance of
`Request` so you would have to override the factory method as well,
-3. By controlling the instantation and depend on specific `Request` and
+3. By controlling the instantiation 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 unittest.
+but could also be somewhere in a unit test.
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 youre $remoteUrl doesn't end with a slash, this one probably shouldn't
+// If your $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 incoded as
+ * This method will also urldecode the path, and if the url was encoded 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.
+ * If the path is outside the base url, a LogicException will be thrown.
*
* @return string
*/
@@ -491,7 +491,7 @@ function getBodyAsStream();
function getBodyAsString();
/**
- * Returns the message body, as it's internal representation.
+ * Returns the message body, as its 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 it's name.
+ * Returns a specific HTTP header, based on its name.
*
* The name must be treated as case-insensitive.
*
@@ -529,7 +529,7 @@ function getHeader($name);
/**
* Updates a HTTP header.
*
- * The case-sensitity of the name value must be retained as-is.
+ * The case-sensitivity 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-insenstive.
+ * The specified header name must be treated as case-insensitive.
* 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 it's internal representation.
+ * Returns the message body, as its 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 it's name.
+ * Returns a specific HTTP header, based on its name.
*
* The name must be treated as case-insensitive.
*
@@ -674,7 +674,7 @@ function getHeader($name);
/**
* Updates a HTTP header.
*
- * The case-sensitity of the name value must be retained as-is.
+ * The case-sensitivity 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-insenstive.
+ * The specified header name must be treated as case-insensitive.
* 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 645f07edd..07f451bc0 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 statuscode (401) to force
+ * This method sends the needed HTTP header and status code (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 d04b4a811..c1bad1a5b 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 statuscode (401) to force
+ * This method sends the needed HTTP header and status code (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 988bb29d2..580e23941 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 statuscode (401) to force
+ * This method sends the needed HTTP header and status code (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 a093d8b75..e80e78305 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($asString = true);
+ $body = $this->request->getBody();
$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 compatibile with mod_php format and other webservers.
+ * It should be compatible 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 99ffcf8cb..2bc7483a7 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
- * succesfully.
+ * successfully.
*
* 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 = [];
/**
- * Wether or not exceptions should be thrown when a HTTP error is returned.
+ * Whether 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 6474f38d2..dc57ca903 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 it's internal representation.
+ * Returns the message body, as its 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 it's name.
+ * Returns a specific HTTP header, based on its 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 exists, this method will return an empty array.
+ * If the header did not exist, 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 6f49dadfc..191ba0f74 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 it's internal representation.
+ * Returns the message body, as its internal representation.
*
* This could be either a string or a stream.
*
@@ -91,7 +91,7 @@ trait MessageDecoratorTrait
}
/**
- * Returns a specific HTTP header, based on it's name.
+ * Returns a specific HTTP header, based on its 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 exists, this method will return an empty array.
+ * If the header did not exist, 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 8504f0f59..4531654bc 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 it's internal representation.
+ * Returns the message body, as its 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 it's name.
+ * Returns a specific HTTP header, based on its 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 exists, this method will return an empty array.
+ * If the header did not exist, this method will return an empty array.
*
* @return string[]
*/
@@ -92,7 +92,7 @@ interface MessageInterface
/**
* Updates a HTTP header.
*
- * The case-sensitity of the name value must be retained as-is.
+ * The case-sensitivity 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-insenstive.
+ * The specified header name must be treated as case-insensitive.
* 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 496629a5b..b8395ff45 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 incoded as
+ * This method will also urldecode the path, and if the url was encoded 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 0ad24925f..23e790e7d 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 incoded as
+ * This method will also urldecode the path, and if the url was encoded 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 83fa85bdc..5ec7777c6 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 incoded as
+ * This method will also urldecode the path, and if the url was encoded 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 2369bb41e..c06c9637e 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-Authorative Information',
+ 203 => 'Non-Authoritative 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 5f9fe7c65..30b9ec0e5 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 9bd93f179..fd73d25cd 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 823d5df25..f8e8397fc 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 polymorhpism.
+ * instantiate this as an object to allow for polymorphism.
*
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
* @author Evert Pot (http://evertpot.com/)
@@ -89,41 +89,33 @@ class Sapi
if (null !== $contentLength) {
$output = fopen('php://output', 'wb');
if (is_resource($body) && 'stream' == get_resource_type($body)) {
- 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));
- }
+ // 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;
- }
- $left -= $copied;
- }
- } else {
- // workaround for 32 Bit systems to avoid stream_copy_to_stream
- while (!feof($body)) {
- fwrite($output, fread($body, 8192));
+ }
+ 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 {
fwrite($output, $body, (int) $contentLength);
@@ -215,7 +207,7 @@ class Sapi
// Normalizing it to be prettier
$header = strtolower(substr($key, 5));
- // Transforming dashes into spaces, and uppercasing
+ // Transforming dashes into spaces, and upper-casing
// 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 f182979c6..47582f22e 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.3';
+ const VERSION = '5.1.6';
}
diff --git a/vendor/sabre/http/lib/functions.php b/vendor/sabre/http/lib/functions.php
index 97673da46..d0477d943 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-negotation.
+ // content-negotiation.
if ('q' !== $partName) {
$parameters[$partName] = $part;
} else {
@@ -404,11 +404,9 @@ function decodePath(string $path): string
function decodePathSegment(string $path): string
{
$path = rawurldecode($path);
- $encoding = mb_detect_encoding($path, ['UTF-8', 'ISO-8859-1']);
- switch ($encoding) {
- case 'ISO-8859-1':
- $path = utf8_encode($path);
+ if (!mb_check_encoding($path, 'UTF-8') && mb_check_encoding($path, 'ISO-8859-1')) {
+ $path = mb_convert_encoding($path, 'UTF-8', 'ISO-8859-1');
}
return $path;