Revert "MDL-39832 Files: Revert MDL-39688 commit, f111746140fe80a821ae69e3bf518d950bf188a1"
This reverts commit 3960c00e3c.
This commit is contained in:
+9
-1
@@ -2021,7 +2021,11 @@ function readfile_accel($file, $mimetype, $accelerate) {
|
||||
header('Last-Modified: '. gmdate('D, d M Y H:i:s', $lastmodified) .' GMT');
|
||||
|
||||
if (is_object($file)) {
|
||||
header('ETag: ' . $file->get_contenthash());
|
||||
if (empty($_SERVER['HTTP_RANGE'])) {
|
||||
// Use Etag only when not byteserving,
|
||||
// is it tag of this range or whole file?
|
||||
header('Etag: ' . $file->get_contenthash());
|
||||
}
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) and $_SERVER['HTTP_IF_NONE_MATCH'] === $file->get_contenthash()) {
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
return;
|
||||
@@ -2671,6 +2675,10 @@ function byteserving_send_file($handle, $mimetype, $ranges, $filesize) {
|
||||
// better turn off any kind of compression and buffering
|
||||
@ini_set('zlib.output_compression', 'Off');
|
||||
|
||||
// Remove Etag because is is not strictly defined for byteserving,
|
||||
// is it tag of this range or whole file?
|
||||
header_remove('Etag');
|
||||
|
||||
$chunksize = 1*(1024*1024); // 1MB chunks - must be less than 2MB!
|
||||
if ($handle === false) {
|
||||
die;
|
||||
|
||||
Reference in New Issue
Block a user