Graham Leggett wrote:
> matt whiteley wrote:
> 
>> I admin a webserver that provides mirrors for a number of open source
>> projects and I frequently see high loads on the server as all files in
>> a directory are stated on each listing. I would like to have a caching
>> system for this so that if the mtime of the directory is not newer
>> than the cached index, the cached index is displayed. This saves both
>> cpu time and speeds up the response to the user request.
> 
> 
> Assuming httpd v2.0+, mod_cache should be able to help with this, either
> the mem cache or the disk cache.
> 
> mod_cache can cache any webserver content no matter how generated
> (proxy, CGI, autoindex, whatever).
> 

I do not think that this will work as expected. Although mod_autoindex can be 
instructed
to set a Last-Modified header via IndexOption TrackModified. It does not handle 
conditional
GET requests (in contrast to HEAD request) in a resource saving manner, because 
it does
regenerate the listing for any GET request. But from my point of view mod_cache 
tries to
revalidate the listing for each new client with a conditional GET request, thus 
causing
mod_autoindex to regenerate the listing.

So I think mod_cache is the correct tool, but mod_autoindex needs to be fixed 
to deliver
what has been expected. The following (untested) patch might do this trick:


--- mod_autoindex.c.orig        2005-02-04 21:21:18.000000000 +0100
+++ mod_autoindex.c     2005-07-28 23:11:46.000000000 +0200
@@ -1948,6 +1948,11 @@
         return HTTP_FORBIDDEN;
     }

+    if ((errstatus = ap_meets_conditions(r)) != OK) {
+        apr_dir_close(thedir);
+        return errstatus;
+    }
+
 #if APR_HAS_UNICODE_FS
     ap_set_content_type(r, "text/html;charset=utf-8");
 #else

Sorry, I have currently no time to test it, so feedback is greatly appreciated.

Regards

RĂ¼diger

Reply via email to