Camilo Sperberg wrote:
Hi list, my first message here :)
To the point: I'm programming a class that takes several CSS files, parses,
compresses and saves into a cache file. However, I would like to go a step
further and also use the browser cache, handling the 304 and 200 header
types myself.
Now, what is the problem? If I do it within a function, there is absolutely
no problem, everything works like a charm. However, when I implement that
same concept into my class, there is no way I can send a 304 Not Modified
header, when the data is *over* ~100 bytes.
Hi Camilo
For what it is worth I have implemented cacheing in a class and for me
the 304 not modified header gets sent fine ... some example headers
output is below together with the relevant code snippet..
// See if client sent a page modified header to see if we can
// just send a not modified header instead
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
$_SERVER['HTTP_IF_MODIFIED_SINCE'] == self::$_gmmodtime) {
header('HTTP/1.1 304 Not Modified');
return null;
}
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) == self::$_etag) {
header('HTTP/1.1 304 Not Modified');
return null;
}
HTTP/1.x 304 Not Modified
Date: Wed, 20 Jan 2010 07:21:32 GMT
Server: Apache/2.2.11 (Ubuntu)
Connection: Keep-Alive
Keep-Alive: timeout=5, max=1000
Etag: 444fbd9951f540ec1b6928db864c10dc
Expires: Sun, 24 Jan 2010 06:16:06 GMT
Cache-Control: public, must-revalidate
Vary: Accept-Encoding
I hope it helps..
Regards
Rich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php