httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental mod_cache.c
Date Mon, 02 Aug 2004 17:30:30 GMT
jerenkrantz    2004/08/02 10:30:30

  Modified:    modules/experimental mod_cache.c
  Log:
  * modules/experimental/mod_cache.c: Delay no-store check until saving.
    (It's a corner case with little benefit in the mainline.)
    (Some nearby style nits also resolved in this patch.)
  
  Reviewed by:	Bill Stoddard
  
  Revision  Changes    Path
  1.85      +14 -11    httpd-2.0/modules/experimental/mod_cache.c
  
  Index: mod_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_cache.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -u -r1.84 -r1.85
  --- mod_cache.c	2 Aug 2004 17:25:24 -0000	1.84
  +++ mod_cache.c	2 Aug 2004 17:30:30 -0000	1.85
  @@ -48,7 +48,7 @@
   static int cache_url_handler(request_rec *r, int lookup)
   {
       apr_status_t rv;
  -    const char *cc_in, *pragma, *auth;
  +    const char *pragma, *auth;
       apr_uri_t uri;
       char *url;
       apr_size_t urllen;
  @@ -95,7 +95,6 @@
        */
   
       /* find certain cache controlling headers */
  -    cc_in = apr_table_get(r->headers_in, "Cache-Control");
       pragma = apr_table_get(r->headers_in, "Pragma");
       auth = apr_table_get(r->headers_in, "Authorization");
   
  @@ -118,13 +117,14 @@
                        "%s, but we know better and are ignoring it", url);
       }
       else {
  -        if (ap_cache_liststr(NULL, cc_in, "no-store", NULL) ||
  -            ap_cache_liststr(NULL, pragma, "no-cache", NULL) || (auth != NULL)) {
  +        if (ap_cache_liststr(NULL, pragma, "no-cache", NULL) ||
  +            auth != NULL) {
               /* delete the previously cached file */
               cache_remove_url(r, cache->types, url);
   
               ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -                         "cache: no-store forbids caching of %s", url);
  +                         "cache: no-cache or authorization forbids caching "
  +                         "of %s", url);
               return DECLINED;
           }
       }
  @@ -326,7 +326,7 @@
       cache_request_rec *cache;
       cache_server_conf *conf;
       char *url = r->unparsed_uri;
  -    const char *cc_out, *cl;
  +    const char *cc_in, *cc_out, *cl;
       const char *exps, *lastmods, *dates, *etag;
       apr_time_t exp, date, lastmod, now;
       apr_off_t size;
  @@ -335,17 +335,20 @@
       apr_pool_t *p;
   
       /* check first whether running this filter has any point or not */
  -    if(r->no_cache) {
  +    /* If the user has Cache-Control: no-store from RFC 2616, don't store! */
  +    cc_in = apr_table_get(r->headers_in, "Cache-Control");
  +    if (r->no_cache || ap_cache_liststr(NULL, cc_in, "no-store", NULL)) {
           ap_remove_output_filter(f);
           return ap_pass_brigade(f->next, in);
       }
   
  -    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -                 "cache: running CACHE_IN filter");
  -
       /* Setup cache_request_rec */
  -    cache = (cache_request_rec *) ap_get_module_config(r->request_config, &cache_module);
  +    cache = (cache_request_rec *) ap_get_module_config(r->request_config,
  +                                                       &cache_module);
       if (!cache) {
  +        /* user likely configured CACHE_IN manually; they should really use
  +         * mod_cache configuration to do that
  +         */
           cache = apr_pcalloc(r->pool, sizeof(cache_request_rec));
           ap_set_module_config(r->request_config, &cache_module, cache);
       }
  
  
  

Mime
View raw message