From 495a3a7c775170a63af72fca0863971ce6e68b3c Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Thu, 7 Mar 2002 22:24:56 +0000 Subject: [PATCH] Bail out gracefully if any part od cache load fails. Still need to handle bailing out of serving out of the cache fails. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93778 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/mod_cache.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c index 86c52aca09..c68024b0f8 100644 --- a/modules/experimental/mod_cache.c +++ b/modules/experimental/mod_cache.c @@ -323,10 +323,7 @@ static int cache_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, r->server, "cache: running CACHE_OUT filter"); - /* XXX: Wouldn't it be better to do read_entity_headers when we - * opened the cache entity? This would better accomodate implementations - * that stored headers and the entity body in seperate files. - */ + /* TODO: Handle getting errors on either of these calls */ cache_read_entity_headers(cache->handle, r); cache_read_entity_body(cache->handle, r->pool, bb); @@ -429,11 +426,14 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) /* have we already run the cachability check and set up the cached file * handle? */ - if(cache->in_checked) { + if (cache->in_checked) { /* pass the brigades into the cache, then pass them * up the filter stack */ - cache_write_entity_body(cache->handle, r, in); + rv = cache_write_entity_body(cache->handle, r, in); + if (rv != APR_SUCCESS) { + ap_remove_output_filter(f); + } return ap_pass_brigade(f->next, in); } @@ -713,8 +713,13 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in) /* * Write away header information to cache. */ - cache_write_entity_headers(cache->handle, r, info); - cache_write_entity_body(cache->handle, r, in); + rv = cache_write_entity_headers(cache->handle, r, info); + if (rv == APR_SUCCESS) { + rv = cache_write_entity_body(cache->handle, r, in); + } + if (rv != APR_SUCCESS) { + ap_remove_output_filter(f); + } return ap_pass_brigade(f->next, in); } -- 2.40.0