CacheMinFileSize and CacheMaxFileSize process the argument with atoi(), which simply means that they'll get -1 if the value is quite large (I need to cache some big files)...
At the same time, I added a small feature I needed: the ability to cache content from sources where content-length is not specified (namely, friggin' JSPs).
This patch encloses both changes...
Pier
diff -r -U3 httpd-2.0.48/modules/experimental/mod_disk_cache.c
CRAP/httpd-2.0.48/modules/experimental/mod_disk_cache.c
--- httpd-2.0.48/modules/experimental/mod_disk_cache.c Mon Feb 3 17:31:36 2003
+++ CRAP/httpd-2.0.48/modules/experimental/mod_disk_cache.c Sun Feb 1 01:13:27
2004
@@ -108,6 +108,7 @@
int dirlevels; /* Number of levels of subdirectories */
int dirlength; /* Length of subdirectory names */
int expirychk; /* true if expiry time is observed for cached
files */
+ int cacheul; /* whether to ignore the file size for caching or
not */
apr_size_t minfs; /* minumum file size for cached files */
apr_size_t maxfs; /* maximum file size for cached files */
apr_time_t mintm; /* minimum time margin for caching files */
@@ -337,11 +338,15 @@
return DECLINED;
}
- if (len < conf->minfs || len > conf->maxfs) {
+ if ((len == -1) && (conf->cacheul)) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "cache_disk: caching request with unknown length",
+ conf->minfs, conf->maxfs);
+ } else if ((len < conf->minfs) || (len > conf->maxfs)) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "cache_disk: URL %s failed the size check, "
- "or is incomplete",
- key);
+ "cache_disk: URL %s failed the size check"
+ "(size=%d) or is incomplete",
+ key, len);
return DECLINED;
}
@@ -702,6 +707,7 @@
conf->dirlevels = DEFAULT_DIRLEVELS;
conf->dirlength = DEFAULT_DIRLENGTH;
conf->space = DEFAULT_CACHE_SIZE;
+ conf->cacheul = FALSE;
conf->maxfs = DEFAULT_MAX_FILE_SIZE;
conf->minfs = DEFAULT_MIN_FILE_SIZE;
conf->expirychk = 1;
@@ -787,11 +793,20 @@
return NULL;
}
static const char
+*set_cache_cacheul(cmd_parms *parms, void *in_struct_ptr, int flag)
+{
+ disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
+ &disk_cache_module);
+ conf->cacheul = flag;
+
+ return NULL;
+}
+static const char
*set_cache_minfs(cmd_parms *parms, void *in_struct_ptr, const char *arg)
{
disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
&disk_cache_module);
- conf->minfs = atoi(arg);
+ conf->minfs = atol(arg);
return NULL;
}
static const char
@@ -799,7 +814,7 @@
{
disk_cache_conf *conf = ap_get_module_config(parms->server->module_config,
&disk_cache_module);
- conf->maxfs = atoi(arg);
+ conf->maxfs = atol(arg);
return NULL;
}
static const char
@@ -862,6 +877,8 @@
"The number of characters in subdirectory names"),
AP_INIT_FLAG("CacheExpiryCheck", set_cache_exchk, NULL, RSRC_CONF,
"on if cache observes Expires date when seeking files"),
+ AP_INIT_FLAG("CacheEnableUnknownLength", set_cache_cacheul, NULL, RSRC_CONF,
+ "on if cache is enabled for requests of unknown length"),
AP_INIT_TAKE1("CacheMinFileSize", set_cache_minfs, NULL, RSRC_CONF,
"The minimum file size to cache a document"),
AP_INIT_TAKE1("CacheMaxFileSize", set_cache_maxfs, NULL, RSRC_CONF,
smime.p7s
Description: S/MIME cryptographic signature
