You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2016/08/16 23:36:51 UTC
svn commit: r1756565 - in /httpd/httpd/branches/2.2.x: CHANGES
modules/cache/mod_mem_cache.c
Author: ylavic
Date: Tue Aug 16 23:36:51 2016
New Revision: 1756565
URL: http://svn.apache.org/viewvc?rev=1756565&view=rev
Log:
mod_mem_cache: Don't cache incomplete responses when the client
connection is aborted before the body is fully read. PR 45049.
Backports: n/a (2.2.x only)
Submitted by: Nick Pace <nick simplylogic.net>, Edward Lu, Yann Ylavic
Reviewed by: ylavic, wrowe, rpluem
Modified:
httpd/httpd/branches/2.2.x/CHANGES
httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c
Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1756565&r1=1756564&r2=1756565&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Tue Aug 16 23:36:51 2016
@@ -28,6 +28,10 @@ Changes with Apache 2.2.32
SubstituteInheritBefore on|off directive. PR 57641
[Marc.Stern <Marc.Stern approach.be>, Yann Ylavic, William Rowe]
+ *) mod_mem_cache: Don't cache incomplete responses when the client
+ connection is aborted before the body is fully read. PR 45049.
+ [Nick Pace <nick simplylogic.net>, Edward Lu, Yann Ylavic]
+
*) abs: Include OPENSSL_Applink when compiling on Windows, to resolve
failures under Visual Studio 2015 and other mismatched MSVCRT flavors.
PR59630 [Jan Ehrhardt <phpdev ehrhardt.nl>]
Modified: httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c?rev=1756565&r1=1756564&r2=1756565&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c Tue Aug 16 23:36:51 2016
@@ -677,12 +677,12 @@ static apr_status_t store_body(cache_han
apr_read_type_e eblock = APR_BLOCK_READ;
apr_bucket *e;
char *cur;
- int eos = 0;
if (mobj->type == CACHE_TYPE_FILE) {
apr_file_t *file = NULL;
int fd = 0;
int other = 0;
+ int eos = 0;
/* We can cache an open file descriptor if:
* - the brigade contains one and only one file_bucket &&
@@ -846,6 +846,15 @@ static apr_status_t store_body(cache_han
*/
AP_DEBUG_ASSERT(obj->count <= mobj->m_len);
}
+ if (r->connection->aborted && !obj->complete) {
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
+ "mem_cache: Discarding body for URL %s "
+ "because client connection was aborted.",
+ obj->key);
+ /* No need to cleanup - obj->complete unset, so
+ * decrement_refcount will discard the object */
+ return APR_EGENERAL;
+ }
return APR_SUCCESS;
}
/**