forked from extern/egroupware
Fix browser's range requests giving an empty file every second download attempt
This commit is contained in:
parent
9bf934d1f5
commit
3870d9803e
@ -1310,13 +1310,13 @@ class HTTP_WebDAV_Server
|
|||||||
if (isset($range['start'])) {
|
if (isset($range['start'])) {
|
||||||
fseek($options['stream'], $range['start'], SEEK_SET);
|
fseek($options['stream'], $range['start'], SEEK_SET);
|
||||||
if (feof($options['stream'])) {
|
if (feof($options['stream'])) {
|
||||||
$this->http_status("416 Requested range not satisfiable");
|
$this->http_status($status = "416 Requested range not satisfiable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($range['end'])) {
|
if (!empty($range['end'])) {
|
||||||
$size = $range['end']-$range['start']+1;
|
$size = $range['end']-$range['start']+1;
|
||||||
$this->http_status("206 Partial content");
|
$this->http_status($status = "206 Partial content");
|
||||||
if (!self::use_compression()) header("Content-Length: $size");
|
if (!self::use_compression()) header("Content-Length: $size");
|
||||||
header("Content-Range: bytes $range[start]-$range[end]/"
|
header("Content-Range: bytes $range[start]-$range[end]/"
|
||||||
. (isset($options['size']) ? $options['size'] : "*"));
|
. (isset($options['size']) ? $options['size'] : "*"));
|
||||||
@ -1326,7 +1326,7 @@ class HTTP_WebDAV_Server
|
|||||||
echo $buffer;
|
echo $buffer;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->http_status("206 Partial content");
|
$this->http_status($status = "206 Partial content");
|
||||||
if (isset($options['size'])) {
|
if (isset($options['size'])) {
|
||||||
if (!self::use_compression()) header("Content-Length: ".($options['size'] - $range['start']));
|
if (!self::use_compression()) header("Content-Length: ".($options['size'] - $range['start']));
|
||||||
header("Content-Range: bytes ".$range['start']."-".
|
header("Content-Range: bytes ".$range['start']."-".
|
||||||
|
Loading…
Reference in New Issue
Block a user