By default it only works for Apache, but for other webservers that pass the right headers through into the environment, this mod to stylesheet.php will do the job:
Code: Select all
// At the top of stylesheet.php...
function emu_getallheaders() {
foreach($_SERVER as $name => $value)
if(substr($name, 0, 5) == 'HTTP_')
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))
)))] = str_replace('\\"', '"', $value);
return $headers;
};
// At the bottom of stylesheet.php...
#Do cache-control stuff
if (function_exists('getallheaders'))
$headers = getallheaders();
else
$headers = emu_getallheaders();
$hash = md5($html);
#if browser sent etag and it is the same then reply with 304
if (isset($headers['If-None-Match']) && $headers['If-None-Match'] == '"'.$hash.'"')
{
header('HTTP/1.1 304 Not Modified');
exit;
}
else
{
header('ETag: "'.$hash.'"');
};
echo $css;
