aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/http/lib/Sapi.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-12-12 14:51:10 +0000
committerMario <mario@mariovavti.com>2019-12-12 14:51:10 +0000
commit544ef3bc588d4180d7ecad15bdacd43813a7c5c5 (patch)
tree62372d0af859287235f62f20d0cf55b5b5b1ace3 /vendor/sabre/http/lib/Sapi.php
parent124cc4396247c75c14280136cfaa95415860ad4c (diff)
downloadvolse-hubzilla-544ef3bc588d4180d7ecad15bdacd43813a7c5c5.tar.gz
volse-hubzilla-544ef3bc588d4180d7ecad15bdacd43813a7c5c5.tar.bz2
volse-hubzilla-544ef3bc588d4180d7ecad15bdacd43813a7c5c5.zip
update composer libs and minor notifications display fixes
Diffstat (limited to 'vendor/sabre/http/lib/Sapi.php')
-rw-r--r--vendor/sabre/http/lib/Sapi.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/sabre/http/lib/Sapi.php b/vendor/sabre/http/lib/Sapi.php
index 80254f3f3..73674a5a1 100644
--- a/vendor/sabre/http/lib/Sapi.php
+++ b/vendor/sabre/http/lib/Sapi.php
@@ -99,7 +99,7 @@ class Sapi
// 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) && '' !== $matches[1]) {
+ 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];
@@ -109,7 +109,15 @@ class Sapi
}
}
while ($left > 0) {
- $left -= stream_copy_to_stream($body, $output, min($left, $chunk_size));
+ $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