mirror of https://github.com/BOINC/boinc.git
Added Expires, Cache-Control, and Last-Modified headers to cached objects.
svn path=/trunk/boinc/; revision=3907
This commit is contained in:
parent
776ddcf840
commit
15bf73b18b
|
@ -21,12 +21,18 @@ function start_cache($max_age, $params=""){
|
|||
//
|
||||
ob_start();
|
||||
ob_implicit_flush(0);
|
||||
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT");
|
||||
Header("Cache-Control: public, max-age=" . $max_age . ", must-revalidate");
|
||||
} else {
|
||||
// Otherwise serve the cached version and exit
|
||||
//
|
||||
if (strstr($params, "format=xml")) {
|
||||
header('Content-type: text/xml');
|
||||
}
|
||||
Header("Last-Modified: " . gmdate("D, d M Y H:i:s",@filemtime($path)) . " GMT");
|
||||
Header("Expires: " . gmdate("D, d M Y H:i:s",@filemtime($path)+$max_age) . " GMT");
|
||||
Header("Cache-Control: public, max-age=" . $max_age . ", must-revalidate");
|
||||
readfile($path);
|
||||
exit;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue