On Mon, 21 May 2007, Roy T. Fielding wrote:

On May 21, 2007, at 7:49 AM, Niklas Edmundsson wrote:
Does anybody see a problem with changing mod_cache to not update the stored headers when the request has max-age=0, the body turns out not to be stale and the on-disk header hasn't expired?

Yes, the problem is that it will break content management systems that
need to refresh a cache front-end after the content has changed.

To quote myself:
---------8<-----------
Does anybody see a problem with changing mod_cache to not update the stored headers when the request has max-age=0, the body turns out not to be stale and the on-disk header hasn't expired?
---------8<-----------

Read the conditions I stated carefully, please.

Since the body isn't stale and the on-disk header hasn't expired it is _exactly the same_ as what is being returned to the client today!

This is because mod_cache already detects this, look in cache_save_filter() for HTTP_NOT_MODIFIED and stale_handle. Today it rewrites the on-disk header and uses the already cached body to fulfill the request.

What I'm requesting is that it skips rewriting the on-disk headers in the case where all these conditions are fulfilled (yes, I'm reiterating here):
- The request has max-age=0
- The body is NOT stale
- The on-disk header hasn't expired

This will NOT break requests where the body/content has changed, since they simply don't fulfill the "body is NOT stale" condition.

The win will be that we don't have to waste IO and cycles rewriting the on-disk headers more or less continuously when objects are hammered with max-age=0 requests, we only have to rewrite the on-disk headers when really needed.

On a side note, shouldn't we check the return value of recall_body() in mod_cache.c?

The rationale behind this is that there are hordes of stupid "download managers" that always issue this kind of request, and multiple in parallell to the same file at that. This hammers the entire cache-layer by causing headers to be rewritten for each request.

Why don't you just add an ignore of cache-control on requests from
those stupid download managers?  A simple BrowserMatch should do.

The download managers sets the same browser-string as ordinary browsers, they are usually indistinguishable from a real browser. Yes, broken. Yes, that's life.

/Nikke
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     [EMAIL PROTECTED]
---------------------------------------------------------------------------
 Never test for an error you don't know how to handle.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Reply via email to