You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by el...@apache.org on 2015/09/01 16:32:39 UTC

svn commit: r1700578 - /httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c

Author: elu
Date: Tue Sep  1 14:32:38 2015
New Revision: 1700578

URL: http://svn.apache.org/r1700578
Log:
Fix mod_mem_cache caching incomplete responses on connection abort

Modified:
    httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c

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=1700578&r1=1700577&r2=1700578&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 Sep  1 14:32:38 2015
@@ -763,6 +763,15 @@ static apr_status_t store_body(cache_han
                     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



Re: svn commit: r1700578 - /httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Sep 1, 2015 at 4:32 PM,  <el...@apache.org> wrote:
> Author: elu
> Date: Tue Sep  1 14:32:38 2015
> New Revision: 1700578
>
> URL: http://svn.apache.org/r1700578
> Log:
> Fix mod_mem_cache caching incomplete responses on connection abort
>
> Modified:
>     httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c
>
> 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=1700578&r1=1700577&r2=1700578&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 Sep  1 14:32:38 2015
> @@ -763,6 +763,15 @@ static apr_status_t store_body(cache_han
>                      return APR_EGENERAL;
>                  }
>              }
> +            if (r->connection->aborted) {

Since store_body() does not use r->connection, don't we know from the
very beginning if r->connection->aborted?
If so, maybe we could fail there.

> +                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
>
>

Re: svn commit: r1700578 - /httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c

Posted by Eric Covener <co...@gmail.com>.
Needs to be proposed in STATUS, even though there is no trunk revision
to reference.

On Tue, Sep 1, 2015 at 10:32 AM,  <el...@apache.org> wrote:
> Author: elu
> Date: Tue Sep  1 14:32:38 2015
> New Revision: 1700578
>
> URL: http://svn.apache.org/r1700578
> Log:
> Fix mod_mem_cache caching incomplete responses on connection abort
>
> Modified:
>     httpd/httpd/branches/2.2.x/modules/cache/mod_mem_cache.c
>
> 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=1700578&r1=1700577&r2=1700578&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 Sep  1 14:32:38 2015
> @@ -763,6 +763,15 @@ static apr_status_t store_body(cache_han
>                      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
>
>



-- 
Eric Covener
covener@gmail.com