Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 40042 invoked from network); 21 Oct 2005 21:54:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Oct 2005 21:54:36 -0000 Received: (qmail 79007 invoked by uid 500); 21 Oct 2005 21:53:30 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 74918 invoked by uid 500); 21 Oct 2005 21:53:06 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 73450 invoked by uid 99); 21 Oct 2005 21:52:48 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 21 Oct 2005 14:51:18 -0700 Received: (qmail 37190 invoked by uid 65534); 21 Oct 2005 21:50:53 -0000 Message-ID: <20051021215053.37189.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r327590 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_http.c Date: Fri, 21 Oct 2005 21:50:52 -0000 To: cvs@httpd.apache.org From: rpluem@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: rpluem Date: Fri Oct 21 14:50:46 2005 New Revision: 327590 URL: http://svn.apache.org/viewcvs?rev=327590&view=rev Log: * Fix PR37145 (data loss with httpd-2.0.55 reverse proxy method=post) by exchanging APR_BRIGADE_CONCAT with ap_save_brigade to ensure that transient buckets get setaside correctly between various iterations of ap_get_brigade calls. Reviewed by: Joe Orton, William Rowe, Jim Jagielski, Jeff Trawick Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=327590&r1=327589&r2=327590&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Fri Oct 21 14:50:46 2005 @@ -27,6 +27,10 @@ Changes with Apache 2.1.9 + *) mod_proxy_http: Prevent data corruption of POST request bodies when + client accesses proxied resources with SSL. PR37145. + [Ruediger Pluem, William Rowe] + *) mod_proxy_balancer: BalancerManager and proxies correctly handle member workers with paths. PR36816. [Ruediger Pluem, Jim Jagielski] Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=327590&r1=327589&r2=327590&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original) +++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Fri Oct 21 14:50:46 2005 @@ -247,7 +247,21 @@ * take care of that now */ bb = header_brigade; - APR_BRIGADE_CONCAT(bb, input_brigade); + + /* + * Save input_brigade in bb brigade. (At least) in the SSL case + * input_brigade contains transient buckets whose data would get + * overwritten during the next call of ap_get_brigade in the loop. + * ap_save_brigade ensures these buckets to be set aside. + * Calling ap_save_brigade with NULL as filter is OK, because + * bb brigade already has been created and does not need to get + * created by ap_save_brigade. + */ + status = ap_save_brigade(NULL, &bb, &input_brigade, p); + if (status != APR_SUCCESS) { + return status; + } + header_brigade = NULL; } else { @@ -354,7 +368,21 @@ * take care of that now */ bb = header_brigade; - APR_BRIGADE_CONCAT(bb, input_brigade); + + /* + * Save input_brigade in bb brigade. (At least) in the SSL case + * input_brigade contains transient buckets whose data would get + * overwritten during the next call of ap_get_brigade in the loop. + * ap_save_brigade ensures these buckets to be set aside. + * Calling ap_save_brigade with NULL as filter is OK, because + * bb brigade already has been created and does not need to get + * created by ap_save_brigade. + */ + status = ap_save_brigade(NULL, &bb, &input_brigade, p); + if (status != APR_SUCCESS) { + return status; + } + header_brigade = NULL; } else { @@ -476,7 +504,21 @@ apr_brigade_cleanup(input_brigade); } else { - APR_BRIGADE_CONCAT(body_brigade, input_brigade); + + /* + * Save input_brigade in body_brigade. (At least) in the SSL case + * input_brigade contains transient buckets whose data would get + * overwritten during the next call of ap_get_brigade in the loop. + * ap_save_brigade ensures these buckets to be set aside. + * Calling ap_save_brigade with NULL as filter is OK, because + * body_brigade already has been created and does not need to get + * created by ap_save_brigade. + */ + status = ap_save_brigade(NULL, &body_brigade, &input_brigade, p); + if (status != APR_SUCCESS) { + return status; + } + } bytes_spooled += bytes; @@ -832,8 +874,26 @@ } apr_brigade_length(temp_brigade, 1, &bytes); - APR_BRIGADE_CONCAT(input_brigade, temp_brigade); bytes_read += bytes; + + /* + * Save temp_brigade in input_brigade. (At least) in the SSL case + * temp_brigade contains transient buckets whose data would get + * overwritten during the next call of ap_get_brigade in the loop. + * ap_save_brigade ensures these buckets to be set aside. + * Calling ap_save_brigade with NULL as filter is OK, because + * input_brigade already has been created and does not need to get + * created by ap_save_brigade. + */ + status = ap_save_brigade(NULL, &input_brigade, &temp_brigade, p); + if (status != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, + "proxy: processing prefetched request body failed" + " to %pI (%s) from %s (%s)", + p_conn->addr, p_conn->hostname ? p_conn->hostname: "", + c->remote_ip, c->remote_host ? c->remote_host: ""); + return status; + } /* Ensure we don't hit a wall where we have a buffer too small * for ap_get_brigade's filters to fetch us another bucket,