httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CASTELLE Thomas <>
Subject mod_cache not sending "If-Modified-Since" headers
Date Wed, 10 Dec 2003 11:48:27 GMT
Hello everyone,
I reported a few months ago a problem concerning mod_cache not sending a
"If-Modified-Since" when the cache is staled (see the end of my e-mail
below). At that time I proposed a patch against 2.0.47 but Paul J. Reder
answered me it was a mod_disk_cache problem and that it will be solved
later. But it's not in the 2.0.48 release.
Does someone has any news about it ?
For your information, I join to this e-mail the patch I wrote against
Thanks in advance for your answer.

-----Message d'origine-----
De : CASTELLE Thomas []
Envoyé : jeudi 12 juin 2003 17:49
À :
Objet : [PATCH] mod_cache RFC compliance


In order to accelerate the RFC compliance of mod_cache, I propose these two
patches which fix two problems : 
- It doesn't handle the Cache-Control directives (max-age, max-stale,
min-fresh...) properly. 
- It doesn't send a "If-Modified-Since" to avoid that the backend server
sends every time a 200 response where a 304 would be enough.

Actually, we are waiting for these features to be implemented since
http-2.0.43 so that we could put Apache in our production environment. I am
not an Apache developper, so this is just a proposition, but I tested it and
it seemed to work.

The cache_util.c patch deals with the first issue. First, the Cache-Control
directive seems to be in the r->err_headers_out and not in the
r->headers_out. Second, the following test seems useless :

        if ((-1 < smaxage && age < (smaxage - minfresh)) || 
          (-1 < maxage && age < (maxage + maxstale - minfresh)) || 
          (info->expire != APR_DATE_BAD && 
           age < (apr_time_sec(info->expire - info->date) + maxstale -
minfresh))) { 

because it is always true, no matter if max-age is set or not. 
Let's take an example (I suppose here s-maxage, max-stale and min-fresh not
so smaxage = - 1, maxstale = 0 and minfresh = 0) : 
- with age = 20, maxage = -1 (not set) and expire - date = 30, the second
is FALSE. The third is TRUE. So the whole test is TRUE, the page is
to be fresh => no problem. 
- with age = 20, maxage = 10 and expire - date = 30, the second test is
but the third is still TRUE. So the whole test is TRUE, the page is
to be fresh => problem. 

The mod_cache.c patch deals with the second issue. The info structure is
never initialized, and even if it was, the info->lastmods and info->etag
don't seem to be saved in the file when using mod_disk_cache. So I used the
Etag and Last-Modified informations we can find in the r->headers_out and
r->err_headers_out. I don't know if it's correct, but it seems to work

Thanks for looking to these patch and eventually integrate it in the next
Apache release ! 

Thanks a lot for this really great product ! 


View raw message