This patch make it possible to return 304s when using the quick handler,
if a fresh cache entity is found.
The r->mtime field is usually set in default_handler() (core.c) by calling
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 ap_meets_conditions()
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 one?
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.
 
Thanks,
 
Jean-Jacques

Attachment: mod_cache.304.patch
Description: Binary data

Reply via email to