This patch takes advantage of the possibility to do the size-check of
the file to be cached early.
The current behaviour is to start caching the file and then bail out
when it notices that it has cached more than the maximum allowed size.
The old checks still has to be there since the size might be unknown
when create_entity() is called.
/Nikke
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se | [EMAIL PROTECTED]
---------------------------------------------------------------------------
"=This= guy's beginning to crisp my cape..." - DarkWing Duck
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Index: mod_disk_cache.c
===================================================================
--- mod_disk_cache.c (revision 410234)
+++ mod_disk_cache.c (working copy)
@@ -330,6 +330,22 @@ static int create_entity(cache_handle_t
return DECLINED;
}
+ /* Note, len is -1 if unknown so don't trust it too hard */
+ if (len > conf->maxfs) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "disk_cache: URL %s failed the size check "
+ "(%" APR_OFF_T_FMT " > %" APR_SIZE_T_FMT ")",
+ key, len, conf->maxfs);
+ return DECLINED;
+ }
+ if (len >= 0 && len < conf->minfs) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "disk_cache: URL %s failed the size check "
+ "(%" APR_OFF_T_FMT " < %" APR_SIZE_T_FMT ")",
+ key, len, conf->minfs);
+ return DECLINED;
+ }
+
/* Allocate and initialize cache_object_t and disk_cache_object_t */
h->cache_obj = obj = apr_pcalloc(r->pool, sizeof(*obj));
obj->vobj = dobj = apr_pcalloc(r->pool, sizeof(*dobj));