From 2ad4d1aac3ce7ffc0ae3afccb4ae7fd0f10c93fa Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 6 Apr 2021 22:04:02 +0200 Subject: [PATCH] fixed Accept-Ranges and Content-Length when requesting partial content --- inc/inc.Utils.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index f7fbccf0d..92969360c 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -646,14 +646,14 @@ function sendFile($filename) { /* {{{ */ } else { $size = filesize($filename); - header("Content-Length: " . $size); if (isset($_SERVER['HTTP_RANGE'])) { $fp = @fopen($filename, 'rb'); $length = $size; // Content length $start = 0; // Start byte $end = $size - 1; // End byte - header("Accept-Ranges: 0-$length"); +// header("Accept-Ranges: 0-$length"); + header("Accept-Ranges: bytes"); $c_start = $start; $c_end = $end; @@ -688,6 +688,7 @@ function sendFile($filename) { /* {{{ */ fseek($fp, $start); header('HTTP/1.1 206 Partial Content'); header("Content-Range: bytes $start-$end/$size"); + header("Content-Length: " . $length); $buffer = 1024 * 8; while(!feof($fp) && ($p = ftell($fp)) <= $end) { @@ -701,6 +702,7 @@ function sendFile($filename) { /* {{{ */ fclose($fp); } else { + header("Content-Length: " . $size); /* Make sure output buffering is off */ if (ob_get_level()) { ob_end_clean();