転送量がやけに多いなぁ、と思っていたら Etag と Last modified の HTTP ヘッダを送信していないためと思われ。というわけで、無理矢理対応。
Etag, Last modified
$last_modified = UNIX_TIME;
$etag = md5($last_modified);
$http_if_none_match = $_SERVER['HTTP_IF_NONE_MATCH'];
$http_if_modified_since = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
@header('Last-modified: ' . gmdate('D, d M Y H:i:s T', $last_modified));
@header('ETag: ' . $etag);
// 304
if ($http_if_modified_since == $last_modified || $etag == $http_if_none_match) {
@header('HTTP/1.x 304');
exit;
}If-modified-since ヘッダは送られてくる形式が 3 つあるらしいけど、php:strtotime 関数に無理矢理入れてる。変な値を送られてもエラー吐かないっぽい。
Related Entries
There is not related articles.
Trackbacks
Trackback URI: http://blog.c--v.net/trackback/2006/09/16/1
There is no trackback.
There is no comment.