ASF Bugzilla – Attachment 24037 Details for
Bug 47580
mod_cache sends 200 response instead of 304
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
PHP script to demonstrate the problem
index.php (text/plain), 930 bytes, created by
Nicholas Sherlock
on 2009-07-25 05:18:51 UTC
(
hide
)
Description:
PHP script to demonstrate the problem
Filename:
MIME Type:
Creator:
Nicholas Sherlock
Created:
2009-07-25 05:18:51 UTC
Size:
930 bytes
patch
obsolete
><?php > >/* Generate our ETag. Assume that generating the ETag is > * a whole lot less expensive than generating the content > * (e.g. it could be based on revision counts for documents > * from a database). > */ >$etag="\"ComputedETag\""; > >header("Etag: $etag"); >header("Expires: " . gmdate("D, d M Y H:i:s", time() > + 60 * 60 * 24 * 30) . " GMT"); > >if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && > $_SERVER['HTTP_IF_NONE_MATCH'] == $etag) { > > /* At a users' request, the cache has been bypassed, but the > * document is still the same. Avoid costly response generation > * and waste of bandwidth by just sending not-modified. > */ > header('HTTP/1.0 304 Not Modified'); > > error_log(date('r')." - Response: 304 Not Modified\n"); > exit(); //Don't generate or send the body >} > >error_log(date('r')." - Response: 200. Generated document.\n"); > >echo "Document body goes here"; > >?>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 47580
: 24037