|
Main sidebar
|
PITS /
01191Summary: HandleDownload should respect EnableIMSCaching
Created: 2010-05-10 04:43
Status: Closed - added for 2.2.17
Category: Bug
From: Eemeli Aro
Assigned:
Priority: 5
Version: 2.2.x
Description:
Setting the To fix this, the following patch is required in upload.php:
--- scripts/upload.php 2010-05-10 10:18:32.000000000 +0300
+++ scripts/upload.php 2010-05-10 12:50:07.000000000 +0300
@@ -176,5 +176,5 @@
function HandleDownload($pagename, $auth = 'read') {
- global $UploadFileFmt, $UploadExts, $DownloadDisposition;
+ global $UploadFileFmt, $UploadExts, $DownloadDisposition, $EnableIMSCaching;
SDV($DownloadDisposition, "inline");
UploadAuth($pagename, $auth);
$upname = MakeUploadName($pagename, @$_REQUEST['upname']);
@@ -184,6 +184,14 @@
Abort("?requested file not found");
exit();
}
+ if (IsEnabled($EnableIMSCaching, 0)) {
+ header('Cache-Control: ');
+ header('Expires: ');
+ $filelastmod = gmdate('D, d M Y H:i:s \G\M\T', filemtime($filepath));
+ if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filelastmod)
+ { header("HTTP/1.0 304 Not Modified"); exit(); }
+ header("Last-Modified: $filelastmod");
+ }
preg_match('/\\.([^.]+)$/',$filepath,$match);
if ($UploadExts[@$match[1]])
header("Content-Type: {$UploadExts[@$match[1]]}");
Do we want to use Could do. header('Cache-Control: private'); is a little bit more lenient and sounds like a more appropriate response, but no-cache would be fine as well. —Eemeli Aro
Private added. Thanks! --Petko See also
|