現状添付ファイルにアクセスしてもLast-modifiedが付加されず、添付ファイルをローカルに保存しようとした場合、タイムスタンプにはダウンロードした時の時刻しか保存されません。もちろんローカルからアップロードした際に「オリジナルのタイムスタンプ」は現状失われている訳ですが、少なくともアップロードされた時刻を返すべきです。
負荷軽減などの観点からBugTrack/799などで議論されていますが、特にここで述べたいのはファイルのメタ情報としてのタイムスタンプという視点です。ファイルシステムにもよりますが、作成日時と更新日時によって前者をダウンロードした日時、後者をファイルがアップロードされた日時としてファイルを管理できます。
余談になりますが、現状多くのWebブラウザはタイムスタンプをうまく取り扱わず、Mozilla でさえもBug 178506として放置され続けています…。
A.6.2. Obsolete dates The following message uses an obsolete date format, including a non- numeric time zone and a two digit year. Note that although the day-of-week is missing, that is not specific to the obsolete syntax; it is optional in the current syntax as well.とあって「Sun, 06 Nov 1994 08:49:37 +0000」の形のみOKに変わったようです。(書式の詳細な定義は3.3. 節を参照)
$filename = htmlspecialchars($filename); + $filetime = date('D, d M Y H:i:s', $this->time) . ' +0000'; ini_set('default_charset', ''); mb_http_output('pass'); pkwk_common_headers(); header('Content-Disposition: inline; filename="' . $filename . '"'); header('Content-Length: ' . $this->size); header('Content-Type: ' . $this->type); + header('Last-Modified: ' . $filetime); @readfile($this->filename); exit; } } // ファイルコンテナ class AttachFiles
} $file = htmlspecialchars($filename); $size = filesize($ref); + $filetime = date('D, d M Y H:i:s', filemtime($ref) - LOCALZONE) . ' +0000'; // Output pkwk_common_headers(); header('Content-Disposition: inline; filename="' . $filename . '"'); header('Content-Length: ' . $size); header('Content-Type: ' . $type); + header('Last-Modified: ' . $filetime); @readfile($ref); exit; } ?>
break; } } + + $filetime = date('D, d M Y H:i:s', filemtime($recent) - LOCALZONE) . ' +0000'; // Feeding start pkwk_common_headers(); header('Content-type: application/xml'); + header('Last-Modified: ' . $filetime); print '<?xml version="1.0" encoding="UTF-8"?>' . "\n\n"; $r_whatsnew = rawurlencode($whatsnew); switch ($version) {
} $file = htmlspecialchars($filename); $size = filesize($ref); + $time = filemtime($ref) - LOCALZONE; + $filetime = date('D, d M Y H:i:s', $time) . ' +0000'; + $etag = sprintf('%x-%x', $size, $time); // Output pkwk_common_headers(); header('Content-Disposition: inline; filename="' . $filename . '"'); header('Content-Length: ' . $size); header('Content-Type: ' . $type); + header('Last-Modified: ' . $filetime); + header('Etag: ' . $etag); + + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH']) && + $_SERVER['HTTP_IF_MODIFIED_SINCE'] === rtrim($filetime, "\r\n") && + $_SERVER['HTTP_IF_NONE_MATCH'] === rtrim($etag, "\r\n")) { + header('HTTP/1.1 304 Not Modified'); + exit; + } + @readfile($ref); exit; } ?>
break; } } + + $size = strlen($page_title . $whatsnew . $lang . $items); + $time = filemtime($recent) - LOCALZONE; + $filetime = date('D, d M Y H:i:s', $time) . ' +0000'; + $etag = sprintf('%x-%x', $size, $time); // Feeding start pkwk_common_headers(); header('Content-type: application/xml'); + header('Last-Modified: ' . $filetime); + header('Etag: ' . $etag); + + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MATCH']) && + $_SERVER['HTTP_IF_MODIFIED_SINCE'] === rtrim($filetime, "\r\n") && + $_SERVER['HTTP_IF_NONE_MATCH'] === rtrim($etag, "\r\n")) { + header('HTTP/1.1 304 Not Modified'); + exit; + } + print '<?xml version="1.0" encoding="UTF-8"?>' . "\n\n"; $r_whatsnew = rawurlencode($whatsnew); switch ($version) {