Commit 5b2ee0a9 authored by Paul Querna's avatar Paul Querna
Browse files

* cache_save_filter:

    *) Remove the first set of Validation code.  Use the main if structure to check for both 'Vary: *' and 'Cache-Control: no-store'.
    *) Add logging of failures for a provider's store_body function.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@190033 13f79535-47bb-0310-9956-ffa450edef68
parent 64b71fd8
Loading
Loading
Loading
Loading
+11 −15
Changes for modules/cache/mod_cache.c: 11 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
    cache_request_rec *cache;
    cache_server_conf *conf;
    char *url = r->unparsed_uri;
    const char *cc_in, *cc_out, *cl, *vary_out;
    const char *cc_out, *cl;
    const char *exps, *lastmods, *dates, *etag;
    apr_time_t exp, date, lastmod, now;
    apr_off_t size;
@@ -247,19 +247,6 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
    conf = (cache_server_conf *) ap_get_module_config(r->server->module_config,
                                                      &cache_module);

    /* If the request has Cache-Control: no-store from RFC 2616, don't store
     * unless CacheStoreNoStore is active.
     */
    cc_in = apr_table_get(r->headers_in, "Cache-Control");
    vary_out = apr_table_get(r->headers_out, "Vary");
    if (r->no_cache ||
        ap_cache_liststr(NULL, vary_out, "*", NULL) ||
        (!conf->store_nostore &&
         ap_cache_liststr(NULL, cc_in, "no-store", NULL))) {
        ap_remove_output_filter(f);
        return ap_pass_brigade(f->next, in);
    }

    /* Setup cache_request_rec */
    cache = (cache_request_rec *) ap_get_module_config(r->request_config,
                                                       &cache_module);
@@ -295,6 +282,8 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
         */
        rv = cache->provider->store_body(cache->handle, r, in);
        if (rv != APR_SUCCESS) {
            ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
                         "cache: Cache provider's store_body failed!");
            ap_remove_output_filter(f);
        }
        return ap_pass_brigade(f->next, in);
@@ -434,9 +423,14 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
         */
        reason = "Authorization required";
    }
    else if (ap_cache_liststr(NULL, 
                              apr_table_get(r->headers_out, "Vary"),
                              "*", NULL)) {
        reason = "Vary header contains '*'";
    }
    else if (r->no_cache) {
        /* or we've been asked not to cache it above */
        reason = "no_cache present";
        reason = "r->no_cache present";
    }

    if (reason) {
@@ -707,6 +701,8 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
        rv = cache->provider->store_body(cache->handle, r, in);
    }
    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, r->server,
                     "cache: store_body failed");
        ap_remove_output_filter(f);
    }