Revert "MDL-39832 Files: Revert MDL-39688 commit, 7c742620d26bdba53e136fda293d33b5271ce241"

This reverts commit 6c227b64e2.
This commit is contained in:
Dan Poltawski
2013-06-13 13:57:32 +08:00
parent 433222d6c0
commit 8c12e634ea
2 changed files with 15 additions and 1 deletions
+9 -1
View File
@@ -2004,7 +2004,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;
@@ -2654,6 +2658,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;
+6
View File
@@ -68,6 +68,12 @@ function xsendfile($filepath) {
}
}
// Remove Etag because is is not strictly defined for byteserving,
// is it tag of this range or whole file?
if (!empty($_SERVER['HTTP_RANGE'])) {
header_remove('Etag');
}
if ($CFG->xsendfile === 'X-LIGHTTPD-send-file') {
// http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file says 1.4 it does not support byteserving
header('Accept-Ranges: none');