Added Expires, Cache-Control, and Last-Modified headers to cached objects.

svn path=/trunk/boinc/; revision=3907
This commit is contained in:
Eric J. Korpela 2004-07-20 18:39:33 +00:00
parent 776ddcf840
commit 15bf73b18b
1 changed files with 6 additions and 0 deletions

View File

@ -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;
}