Changes with Apache 2.0.44
+ *) Improves the user friendliness of the CacheRoot processing
+ over my last pass. This version avoids the pool allocations
+ but doesn't avoid all of the runtime checks. It no longer
+ terminates during post-config processing. An error is logged
+ once per worker, indicating that the CacheRoot needs to be set.
+ [Paul J. Reder]
+
*) Fix a bug where we keep files open until the end of a
keepalive connection, which can result in:
(24)Too many open files: file permissions deny server access
APACHE 2.0 STATUS: -*-text-*-
-Last modified at [$Date: 2002/10/31 05:57:33 $]
+Last modified at [$Date: 2002/11/08 22:42:18 $]
Release:
* mod_mem_cache/mod_disk_cache: Complete implementing config
directives (mod_disk_cache: CacheExpiryCheck and GC directives
- including CacheGc*, CacheSize, CacheMaxFileSize, CacheMinFileSize,
- and, CacheTimeMargin) (mod_mem_cache: MCacheMaxObjectCount) and
- (mod_cache: cacheForceCompletion).
-
- * mod_cache/mod_mem_cache/mod_disk_cache: Documentation.
+ including CacheGc*, CacheSize, and, CacheTimeMargin)
+ (mod_mem_cache: MCacheMaxObjectCount) and
+ (mod_cache: CacheForceCompletion).
mod_auth_ldap/util_ldap:
apr_file_t *tmpfile;
if (strcasecmp(type, "disk")) {
- return DECLINED;
+ return DECLINED;
+ }
+
+ if (conf->cache_root == NULL) {
+ return DECLINED;
}
if (len < conf->minfs || len > conf->maxfs) {
static int open_entity(cache_handle_t *h, request_rec *r, const char *type, const char *key)
{
apr_status_t rc;
+ static int error_logged = 0;
disk_cache_conf *conf = ap_get_module_config(r->server->module_config,
&disk_cache_module);
- char *data = data_file(r->pool, conf->dirlevels, conf->dirlength,
- conf->cache_root, key);
- char *headers = header_file(r->pool, conf->dirlevels, conf->dirlength,
- conf->cache_root, key);
+ char *data;
+ char *headers;
apr_file_t *fd;
apr_file_t *hfd;
apr_finfo_t finfo;
/* Look up entity keyed to 'url' */
if (strcasecmp(type, "disk")) {
- return DECLINED;
+ return DECLINED;
+ }
+
+ if (conf->cache_root == NULL) {
+ if (!error_logged) {
+ error_logged = 1;
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+ "disk_cache: Cannot cache files to disk without a CacheRoot specified.");
+ }
+ return DECLINED;
}
+ data = data_file(r->pool, conf->dirlevels, conf->dirlength,
+ conf->cache_root, key);
+ headers = header_file(r->pool, conf->dirlevels, conf->dirlength,
+ conf->cache_root, key);
+
/* Open the data file */
rc = apr_file_open(&fd, data, APR_READ|APR_BINARY, 0, r->pool);
if (rc != APR_SUCCESS) {
return NULL;
}
-static int disk_cache_post_config(apr_pool_t *p, apr_pool_t *plog,
- apr_pool_t *ptemp, server_rec *s)
-{
- disk_cache_conf *conf = ap_get_module_config(s->module_config,
- &disk_cache_module);
- if (conf->cache_root == NULL) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, 0, s,
- "CacheRoot must be initialized for mod_disk_cache to function.");
-
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
- return OK;
-}
-
static const command_rec disk_cache_cmds[] =
{
AP_INIT_TAKE1("CacheRoot", set_cache_root, NULL, RSRC_CONF,
cache_hook_create_entity(create_entity, NULL, NULL, APR_HOOK_MIDDLE);
cache_hook_open_entity(open_entity, NULL, NULL, APR_HOOK_MIDDLE);
/* cache_hook_remove_entity(remove_entity, NULL, NULL, APR_HOOK_MIDDLE); */
- ap_hook_post_config(disk_cache_post_config, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA disk_cache_module = {