]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1572543 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Wed, 12 Mar 2014 12:37:06 +0000 (12:37 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 12 Mar 2014 12:37:06 +0000 (12:37 +0000)
Cleanup the client to backend brigade before returning an error (if any) to avoid buckets lifetime issues (backend connection's pool destroyed before request's one). PR 50335.
Suggested by rpluem.

Submitted by: ylavic
Reviewed by: ylavic, rpluem, wrowe

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1576714 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_http.c

index ad279858a1d7d1a1c9e85b2ce8f25ab5b943ba67..ca3c5ee5fee87e4fc45e33165d3e462943f13e4f 100644 (file)
@@ -267,6 +267,9 @@ static int pass_brigade(apr_bucket_alloc_t *bucket_alloc,
     if (transferred != -1)
         conn->worker->s->transferred += transferred;
     status = ap_pass_brigade(origin->output_filters, bb);
+    /* Cleanup the brigade now to avoid buckets lifetime
+     * issues in case of error returned below. */
+    apr_brigade_cleanup(bb);
     if (status != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
                      "proxy: pass request body failed to %pI (%s)",
@@ -286,7 +289,6 @@ static int pass_brigade(apr_bucket_alloc_t *bucket_alloc,
             return HTTP_BAD_REQUEST; 
         }
     }
-    apr_brigade_cleanup(bb);
     return OK;
 }