[Pkg-owncloud-commits] [php-sabredav] 07/28: Fall back to manually seeking if fseek fails.
David Prévot
taffit at moszumanska.debian.org
Sun Mar 13 17:59:07 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabredav.
commit 9629f390f6b0e39c6a9fda0a15d3c943e3c70661
Author: Evert Pot <me at evertpot.com>
Date: Sun Feb 28 15:03:59 2016 -0500
Fall back to manually seeking if fseek fails.
This is a potential fix for #787. This targets the 3.0 branch and should
then get merged into the 3.1 and master branches.
@PVince81: How does this look?
---
lib/DAV/CorePlugin.php | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php
index a0ce43c..046e395 100644
--- a/lib/DAV/CorePlugin.php
+++ b/lib/DAV/CorePlugin.php
@@ -169,12 +169,10 @@ class CorePlugin extends ServerPlugin {
}
- // for a seekable $body stream we simply set the pointer
- // for a non-seekable $body stream we read and discard just the
- // right amount of data
- if (stream_get_meta_data($body)['seekable']) {
- fseek($body, $start, SEEK_SET);
- } else {
+ // Streams may advertise themselves as seekable, but still not
+ // actually allow fseek. We'll manually go forward in the stream
+ // if fseek failed.
+ if (!stream_get_meta_data($body)['seekable'] || fseek($body, $start, SEEK_SET) === 0) {
$consumeBlock = 8192;
for ($consumed = 0; $start - $consumed > 0;){
if (feof($body)) throw new Exception\RequestedRangeNotSatisfiable('The start offset (' . $start . ') exceeded the size of the entity (' . $consumed . ')');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-php/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list