Hi,

Actually, the cache module is not handling slash ending url and it's impossible with any directive do cache this kind or url.
When i send this problem on the mailing few weeks ago, i read on mail answer that was maybe because it could happen problem with negociation and caching slash ending url.

I wrote a little directive: CacheSlashEndingUrl On/Off which is per default at Off, to cache slash ending url.
i dunno if it can be usefull but i send you the patch.

About the negociations, on all website i tested on, there is store and no-cache headers which make the url non cachable.

regards,

Estrade Matthieu
? patch.cache
? patch.slash.cache
Index: mod_cache.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_cache.c,v
retrieving revision 1.62
diff -u -r1.62 mod_cache.c
--- mod_cache.c 6 Nov 2002 14:08:31 -0000       1.62
+++ mod_cache.c 18 Nov 2002 10:13:20 -0000
@@ -124,10 +124,6 @@
                      "cache: URL exceeds length threshold: %s", url);
         return DECLINED;
     }
-    /* DECLINE urls ending in / ??? EGP: why? */
-    if (url[urllen-1] == '/') {
-        return DECLINED;
-    }
 
     /* make space for the per request config */
     cache = (cache_request_rec *) ap_get_module_config(r->request_config, 
@@ -137,6 +133,12 @@
         ap_set_module_config(r->request_config, &cache_module, cache);
     }
 
+    if (conf->cache_slash_endingurl == 0) {
+        if (url[urllen-1] == '/') {
+            return DECLINED;
+        }
+    }
+
     /* save away the type */
     cache->types = types;
 
@@ -912,6 +914,8 @@
     ps->ignorecachecontrol = 0;
     ps->ignorecachecontrol_set = 0 ;
     ps->max_streaming_buffer_size = 0;
+    ps->cache_slash_endingurl = 0;
+    ps->cache_slash_endingurl_set = 0;
     return ps;
 }
 
@@ -953,6 +957,11 @@
         ? base->max_streaming_buffer_size
         : overrides->max_streaming_buffer_size;
 
+    ps->cache_slash_endingurl  =
+        (overrides->cache_slash_endingurl_set == 0)
+        ? base->cache_slash_endingurl
+        : overrides->cache_slash_endingurl;
+
     return ps;
 }
 static const char *set_cache_ignore_no_last_mod(cmd_parms *parms, void *dummy,
@@ -1090,6 +1099,20 @@
     return NULL;
 }
 
+static const char *set_cache_slash_endingurl(cmd_parms *parms, void *dummy,
+                                             int flag)
+{
+    cache_server_conf *conf;
+                                                
+    conf =
+        (cache_server_conf *)ap_get_module_config(parms->server->module_config,
+                                                  &cache_module);
+    conf->cache_slash_endingurl = flag;
+    conf->cache_slash_endingurl_set = 1;
+    return NULL;
+                                                                                 
+}
+
 static int cache_post_config(apr_pool_t *p, apr_pool_t *plog,
                              apr_pool_t *ptemp, server_rec *s)
 {
@@ -1140,6 +1163,10 @@
                   RSRC_CONF,
                   "Maximum number of bytes of content to buffer for "
                   "a streamed response"),
+     AP_INIT_FLAG("CacheSlashEndingUrl", set_cache_slash_endingurl,
+                  NULL,
+                  RSRC_CONF,
+                  "Enabling cache on Slash ending Url"),
     {NULL}
 };
 
Index: mod_cache.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_cache.h,v
retrieving revision 1.36
diff -u -r1.36 mod_cache.h
--- mod_cache.h 17 Nov 2002 01:33:25 -0000      1.36
+++ mod_cache.h 18 Nov 2002 10:13:20 -0000
@@ -179,6 +179,9 @@
     /** ignore client's requests for uncached responses */
     int ignorecachecontrol;
     int ignorecachecontrol_set;
+    /* enable/disable cache on slash ending url */
+    int cache_slash_endingurl;
+    int cache_slash_endingurl_set;
     /* maximum amount of data to buffer on a streamed response where
      * we haven't yet seen EOS */
     apr_off_t max_streaming_buffer_size;


Reply via email to