diff --git a/components/ILIAS/FileDelivery/classes/FileDeliveryTypes/PHPChunked.php b/components/ILIAS/FileDelivery/classes/FileDeliveryTypes/PHPChunked.php index 0c8e1850a5df..9f3d94107aa6 100755 --- a/components/ILIAS/FileDelivery/classes/FileDeliveryTypes/PHPChunked.php +++ b/components/ILIAS/FileDelivery/classes/FileDeliveryTypes/PHPChunked.php @@ -108,9 +108,10 @@ public function deliver(string $path_to_file, bool $file_marked_to_delete): void * (mediatype = mimetype) * as well as a boundry header to indicate the various chunks of data. */ - $response = $this->httpService->response()->withHeader("Accept-Ranges", "0-$length"); + $response = $this->httpService->response()->withHeader(ResponseHeader::ACCEPT_RANGES, 'bytes'); $this->httpService->saveResponse($response); $server = $this->httpService->request()->getServerParams(); + $is_partial = false; // header('Accept-Ranges: bytes'); // multipart/byteranges // http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 @@ -161,6 +162,7 @@ public function deliver(string $path_to_file, bool $file_marked_to_delete): void $end = $c_end; $length = $end - $start + 1; // Calculate new content length fseek($fp, (int) $start); + $is_partial = true; $response = $this->httpService->response()->withStatus(206); @@ -168,7 +170,10 @@ public function deliver(string $path_to_file, bool $file_marked_to_delete): void } // fim do if // Notify the client the byte range we'll be outputting - $response = $this->httpService->response()->withHeader(ResponseHeader::CONTENT_RANGE, "bytes $start-$end/$size")->withHeader(ResponseHeader::CONTENT_LENGTH, $length); + $response = $this->httpService->response()->withHeader(ResponseHeader::CONTENT_LENGTH, (string) $length); + if ($is_partial) { + $response = $response->withHeader(ResponseHeader::CONTENT_RANGE, "bytes $start-$end/$size"); + } $this->httpService->saveResponse($response);