From: Graham Leggett Date: Wed, 13 Oct 2004 16:40:57 +0000 (+0000) Subject: Do not store aborted content. X-Git-Tag: 2.0.53~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aef230205e8f87a1e95c93bc8010377309510099;p=thirdparty%2Fapache%2Fhttpd.git Do not store aborted content. PR: 21492 Obtained from: Submitted by: R|diger Pl|m Reviewed by: stoddard, jerenkrantz, minfrin, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@105430 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 6a17bb8e89c..8e5daa2462f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.53 + *) mod_disk_cache: Do not store aborted content. PR 21492. + [Rüiger Plü ] + *) mod_disk_cache: Correctly store cached content type. PR 30278. [Rüiger Plü ] diff --git a/STATUS b/STATUS index fdde6e56f5e..4a72fa79ee7 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/10/13 16:32:05 $] +Last modified at [$Date: 2004/10/13 16:40:54 $] Release: @@ -115,10 +115,6 @@ PATCHES TO BACKPORT FROM 2.1 jorton replies: it does indeed, hang on... +1: jorton - *) Do not store aborted content. PR 21492. - modules/experimental/mod_disk_cache.c?r1=1.63&r2=1.64 - +1: stoddard, jerenkrantz, minfrin, jim - *) Try to correctly follow RFC 2616 13.3 on validating stale cache responses by teaching mod_cache's cache_select_url and cache_save_filter how to deal with this corner case. diff --git a/modules/experimental/mod_disk_cache.c b/modules/experimental/mod_disk_cache.c index 7b753ee6d46..1a8e3b7d835 100644 --- a/modules/experimental/mod_disk_cache.c +++ b/modules/experimental/mod_disk_cache.c @@ -704,6 +704,22 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, */ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { if (h->cache_obj->info.len <= 0) { + /* If the target value of the content length is unknown + * (h->cache_obj->info.len <= 0), check if connection has been + * aborted by client to avoid caching incomplete request bodies. + * + * This can happen with large responses from slow backends like + * Tomcat via mod_jk. + */ + if (r->connection->aborted) { + ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, + "disk_cache: Discarding body for URL %s " + "because connection has been aborted.", + h->cache_obj->key); + /* Remove the intermediate cache file and return non-APR_SUCCESS */ + file_cache_errorcleanup(dobj, r); + return APR_EGENERAL; + } /* XXX Fixme: file_size isn't constrained by size_t. */ h->cache_obj->info.len = dobj->file_size; }