Commit 4da95045 authored by Yann Ylavic's avatar Yann Ylavic
Browse files

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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1756565 13f79535-47bb-0310-9956-ffa450edef68
parent 8278eccf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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>]
+10 −1
Original line number Diff line number Diff line
@@ -677,12 +677,12 @@ static apr_status_t store_body(cache_handle_t *h, request_rec *r, apr_bucket_bri
    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_handle_t *h, request_rec *r, apr_bucket_bri
         */
        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;
}
/**