* 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
This commit is contained in:
Ruediger Pluem
2006-03-29 06:53:51 +00:00
parent aabe8f9afe
commit a11b86ee63

View File

@ -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,