On Sun, Sep 11, 2005 at 07:07:23AM -0500, aaron@...749... wrote:
<?php $mtime = filemtime($_SERVER['SCRIPT_FILENAME']); $gmdate_mod = gmdate('D, d M Y H:i:s', $mtime) . ' GMT'; header("Last-Modified: $gmdate_mod"); ?>
Nope, you need to actually process client headers for "If-Match" sequences, generate Etags, modtimes, etc. Craziness, but doable:
e.g.:
$hash = md5($file);
// FIXME: this header needs to change if it's not a jpeg... header("Content-type: image/jpeg");
$headers = getallheaders(); if (ereg($hash,$headers['If-None-Match'])) { header('HTTP/1.1 304 Not Modified'); } else { header("ETag: "{$hash}""); header("Last-Modified: ".gmdate("D, d M Y H:i:s", filemtime($file)) . " GMT"); header("Content-Length: ".filesize($file));
$fp = @fopen($file,"rb"); fpassthru($fp); fclose($fp); }