diff options
author | Ruediger Pluem <rpluem@apache.org> | 2006-03-29 08:53:51 +0200 |
---|---|---|
committer | Ruediger Pluem <rpluem@apache.org> | 2006-03-29 08:53:51 +0200 |
commit | a11b86ee6312d60bfb4c40fd736b5282a9825075 (patch) | |
tree | fde1cf6bf826a250d04c0291896b15d5d7405d45 /modules/cache | |
parent | PR#39133 (diff) | |
download | apache2-a11b86ee6312d60bfb4c40fd736b5282a9825075.tar.xz apache2-a11b86ee6312d60bfb4c40fd736b5282a9825075.zip |
* Check return value of apr_bucket_read when storing the response body to disk.
Delete already cached data if an error occurs.
Submitted by: Brian Akins <brian.akins turner.com>
Reviewed by: Ruediger Pluem
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@389697 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | modules/cache/mod_disk_cache.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c index 79ed6f14b4..b1b8f9801d 100644 --- a/modules/cache/mod_disk_cache.c +++ b/modules/cache/mod_disk_cache.c @@ -984,7 +984,15 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, { const char *str; apr_size_t length, written; - apr_bucket_read(e, &str, &length, APR_BLOCK_READ); + rv = apr_bucket_read(e, &str, &length, APR_BLOCK_READ); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + "cache_disk: Error when reading bucket for URL %s", + h->cache_obj->key); + /* Remove the intermediate cache file and return non-APR_SUCCESS */ + file_cache_errorcleanup(dobj, r); + return APR_EGENERAL; + } rv = apr_file_write_full(dobj->tfd, str, length, &written); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, |