aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/http/lib
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/http/lib')
-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
17 files changed, 66 insertions, 56 deletions
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;