Commit 281391af authored by Bill Stoddard's avatar Bill Stoddard
Browse files

Uninstall the filter if the caching layer declines the cache request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90633 13f79535-47bb-0310-9956-ffa450edef68
parent 5e5260dc
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -347,6 +347,7 @@ int ap_cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in);

int ap_cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
{
    int rv;
    request_rec *r = f->r;
    char *url = r->unparsed_uri;
    const char *cc_out = ap_table_get(r->headers_out, "Cache-Control");
@@ -520,7 +521,7 @@ int ap_cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
     */
    /* no cache handle, create a new entity */
    if (!cache->handle) {
        cache_create_entity(r, cache->types, url, size);
        rv = cache_create_entity(r, cache->types, url, size);
    }
    /* pre-existing cache handle and 304, make entity fresh */
    else if (r->status == HTTP_NOT_MODIFIED) {
@@ -531,9 +532,14 @@ int ap_cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
    /* pre-existing cache handle and new entity, replace entity with this one */
    else {
        cache_remove_entity(r, cache->types, cache->handle);
        cache_create_entity(r, cache->types, url, size);
        rv = cache_create_entity(r, cache->types, url, size);
    }
    
    if (rv != OK) {
        /* Caching layer declined the opportunity to cache the response */
        ap_remove_output_filter(f);
        return ap_pass_brigade(f->next, in);
    }
    
    /*
     * We now want to update the cache file header information with