httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Jacques Clar" <>
Subject [PATCH] mod_cache: returning 304s running the quick handler
Date Thu, 05 Feb 2004 19:07:04 GMT
This patch make it possible to return 304s when using the quick
if a fresh cache entity is found.
The r->mtime field is usually set in default_handler() (core.c) by
ap_update_mtime(), which does not happen when the quick handler 
find a fresh cache entry.
>From cache_url_handler(), the r->mtime field is then used in
to determine if the browser/proxy cached copy is older than the one on
the current server. 
If not, the server should returns a 304.
In our case because the r->mtime field is never set, then the tested
variable in 
ap_meets_condition() is always set using a call to apr_time_now(). 
304s are then not possible when using caching modules.

The patch just update mtime based on what was stored in the lastmod
field when the entity was 
cached during a previous request.
+++ modules/experimental/mod_cache.c 30 Jan 2004 17:07:15 -0000
@@ -216,6 +216,12 @@
             if (lookup) {
                 return OK;
+            info = &(cache->handle->cache_obj->info);
+            if (info && info->lastmod) {
+                ap_update_mtime(r, info->lastmod);
+            }
             rv = ap_meets_conditions(r);
There is probably a PR, but I did not find it; any idea if there is
Please let me know if you think there is a problem/better way, if not I
will commit 
the attached patch first part of next week.

View raw message