From 0c31477c0419c310c340dc8d704585289f0f594a Mon Sep 17 00:00:00 2001 From: Edward Lu Date: Tue, 1 Sep 2015 14:32:38 +0000 Subject: [PATCH] Fix mod_mem_cache caching incomplete responses on connection abort git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1700578 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cache/mod_mem_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/cache/mod_mem_cache.c b/modules/cache/mod_mem_cache.c index b845b98330a..826c4afc0f4 100644 --- a/modules/cache/mod_mem_cache.c +++ b/modules/cache/mod_mem_cache.c @@ -763,6 +763,15 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_bri return APR_EGENERAL; } } + if (r->connection->aborted) { + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, + "mem_cache: Discarding body for URL %s " + "because connection was aborted.", + obj->key); + /* No need to cleanup - obj->complete unset, so + * decrement_refcount will discard the object */ + return APR_EGENERAL; + } if (mobj->m_len > obj->count) { /* Caching a streamed response. Reallocate a buffer of the * correct size and copy the streamed response into that -- 2.47.2