httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Edmundsson <ni...@acc.umu.se>
Subject [PATCH]: mod_cache: don't store headers that will never be used
Date Sun, 29 Jul 2007 08:03:07 GMT

Attached is a patch for mod_cache (patch is for httpd-2.2.4) that 
implements what I suggested in May (see the entire thread at
http://mail-archives.apache.org/mod_mbox/httpd-dev/200705.mbox/%3cPine.GSO.4.64.0705211627320.5452@kleopatra.acc.umu.se%3e

).

The problem is that cached objects that gets hammered with 
Cache-Control: max-age=0 requests will get their on-disk headers 
rewritten for each request, and since max-age=0 are always revalidated 
(hence the rewriting in the first place) those rewritten on-disk 
headers will never be used. Since the ground rule of caching is to 
cache stuff that's being reused this is rather suboptimal.

The solution is to NOT rewrite the on-disk headers when the following 
conditions are true:
- The body is NOT stale (ie. HTTP_NOT_MODIFIED when revalidating)
- The on-disk header hasn't expired.
- The request has max-age=0

This is perfectly OK with RFC2616 10.3.5 and does NOT break anything.

Patch is tested on httpd-2.2.4 and works as expected according to my 
tests.


/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke@acc.umu.se
---------------------------------------------------------------------------
  A pretty .GIF is like a melody
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mime
View raw message