From: Paul Querna Date: Sat, 1 Apr 2006 06:26:56 +0000 (+0000) Subject: Merge r389697 and r390499 from trunk, making mod_disk_cache return better error codes... X-Git-Tag: 2.2.1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6c31184e0b5967a952a2789e66c37579fdb08b6;p=thirdparty%2Fapache%2Fhttpd.git Merge r389697 and r390499 from trunk, making mod_disk_cache return better error codes, instead of a silly APR_EGENERAL. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@390598 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d8d0ba6c6bf..bf62e8a24b9 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,10 @@ Changes with Apache 2.2.1 made to ap_escape_html so we escape quotes. Reported by JPCERT. [Mark Cox] + *) mod_disk_cache: Return the correct error codes from bucket read + failures, instead of APR_EGENERAL. + [Brian Akins ] + *) Add APR/APR-Util Compiled and Runtime Version numbers to the output of 'httpd -V'. [William Rowe] diff --git a/STATUS b/STATUS index 1d8b7061ffb..d9b9d43bfc3 100644 --- a/STATUS +++ b/STATUS @@ -75,14 +75,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_disk_cache: Return correct error codes, instead of APR_EGENERAL. - Trunk version of patch: - http://svn.apache.org/viewcvs?rev=389697&view=rev - http://svn.apache.org/viewcvs?rev=390499&view=rev - Backport version for 2.2.x of patch: - Trunk version of patch works - +1: rpluem, pquerna, rooneg - PATCHES PROPOSED TO BACKPORT FROM TRUNK: * mod_dbd: When threaded, create a private pool in child_init diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c index 79ed6f14b48..bf342792716 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 rv; + } rv = apr_file_write_full(dobj->tfd, str, length, &written); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, @@ -992,7 +1000,7 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, h->cache_obj->key); /* Remove the intermediate cache file and return non-APR_SUCCESS */ file_cache_errorcleanup(dobj, r); - return APR_EGENERAL; + return rv; } dobj->file_size += written; if (dobj->file_size > conf->maxfs) {