httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rede...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental mod_disk_cache.c
Date Fri, 08 Nov 2002 22:42:19 GMT
rederpj     2002/11/08 14:42:19

  Modified:    .        CHANGES STATUS
               modules/experimental mod_disk_cache.c
  Log:
  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]
  
  Revision  Changes    Path
  1.973     +7 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.972
  retrieving revision 1.973
  diff -u -r1.972 -r1.973
  --- CHANGES	8 Nov 2002 17:19:09 -0000	1.972
  +++ CHANGES	8 Nov 2002 22:42:18 -0000	1.973
  @@ -1,5 +1,12 @@
   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
  
  
  
  1.744     +4 -6      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.743
  retrieving revision 1.744
  diff -u -r1.743 -r1.744
  --- STATUS	31 Oct 2002 05:57:33 -0000	1.743
  +++ STATUS	8 Nov 2002 22:42:18 -0000	1.744
  @@ -525,11 +525,9 @@
   
       * 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:
       
  
  
  
  1.44      +23 -22    httpd-2.0/modules/experimental/mod_disk_cache.c
  
  Index: mod_disk_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_disk_cache.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- mod_disk_cache.c	7 Nov 2002 23:11:10 -0000	1.43
  +++ mod_disk_cache.c	8 Nov 2002 22:42:19 -0000	1.44
  @@ -330,7 +330,11 @@
       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) {
  @@ -382,12 +386,11 @@
   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;
  @@ -399,9 +402,23 @@
   
       /* 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) {
  @@ -830,21 +847,6 @@
       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,
  @@ -882,7 +884,6 @@
       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 = {
  
  
  

Mime
View raw message