Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2021-04-06 22:04:43 +02:00
commit e10b7ff3e3

View File

@ -663,14 +663,14 @@ function sendFile($filename) { /* {{{ */
} else { } else {
$size = filesize($filename); $size = filesize($filename);
header("Content-Length: " . $size);
if (isset($_SERVER['HTTP_RANGE'])) { if (isset($_SERVER['HTTP_RANGE'])) {
$fp = @fopen($filename, 'rb'); $fp = @fopen($filename, 'rb');
$length = $size; // Content length $length = $size; // Content length
$start = 0; // Start byte $start = 0; // Start byte
$end = $size - 1; // End byte $end = $size - 1; // End byte
header("Accept-Ranges: 0-$length"); // header("Accept-Ranges: 0-$length");
header("Accept-Ranges: bytes");
$c_start = $start; $c_start = $start;
$c_end = $end; $c_end = $end;
@ -705,6 +705,7 @@ function sendFile($filename) { /* {{{ */
fseek($fp, $start); fseek($fp, $start);
header('HTTP/1.1 206 Partial Content'); header('HTTP/1.1 206 Partial Content');
header("Content-Range: bytes $start-$end/$size"); header("Content-Range: bytes $start-$end/$size");
header("Content-Length: " . $length);
$buffer = 1024 * 8; $buffer = 1024 * 8;
while(!feof($fp) && ($p = ftell($fp)) <= $end) { while(!feof($fp) && ($p = ftell($fp)) <= $end) {
@ -718,6 +719,7 @@ function sendFile($filename) { /* {{{ */
fclose($fp); fclose($fp);
} else { } else {
header("Content-Length: " . $size);
/* Make sure output buffering is off */ /* Make sure output buffering is off */
if (ob_get_level()) { if (ob_get_level()) {
ob_end_clean(); ob_end_clean();