Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 63602 invoked from network); 27 Feb 2008 21:36:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Feb 2008 21:36:14 -0000 Received: (qmail 98578 invoked by uid 500); 27 Feb 2008 21:36:09 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 98521 invoked by uid 500); 27 Feb 2008 21:36:09 -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 98510 invoked by uid 99); 27 Feb 2008 21:36:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2008 13:36:08 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2008 21:35:22 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3505D1A9832; Wed, 27 Feb 2008 13:35:42 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r631735 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy.c Date: Wed, 27 Feb 2008 21:35:41 -0000 To: cvs@httpd.apache.org From: rpluem@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080227213542.3505D1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rpluem Date: Wed Feb 27 13:35:39 2008 New Revision: 631735 URL: http://svn.apache.org/viewvc?rev=631735&view=rev Log: * Do not retry a direct connection if the request has a request body Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/proxy/mod_proxy.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=631735&r1=631734&r2=631735&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Wed Feb 27 13:35:39 2008 @@ -2,6 +2,10 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) mod_proxy: Do not try a direct connection if the connection via a + remote proxy failed before and the request has a request body. + [Ruediger Pluem] + *) mod_include: Correctly handle SSI directives split over multiple filter passes. PR 44447 [Harald Niesche ] Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=631735&r1=631734&r2=631735&view=diff ============================================================================== --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original) +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Feb 27 13:35:39 2008 @@ -932,12 +932,41 @@ ents[i].hostname, ents[i].port); - /* an error or success */ - if (access_status != DECLINED && - access_status != HTTP_BAD_GATEWAY) { - goto cleanup; + /* Did the scheme handler process the request? */ + if (access_status != DECLINED) { + const char *cl_a; + char *end; + apr_off_t cl; + + /* + * An fatal error or success, so no point in + * retrying with a direct connection. + */ + if (access_status != HTTP_BAD_GATEWAY) { + goto cleanup; + } + cl_a = apr_table_get(r->headers_in, "Content-Length"); + if (cl_a) { + apr_strtoff(&cl, cl_a, &end, 0); + /* + * The request body is of length > 0. We cannot + * retry with a direct connection since we already + * sent (parts of) the request body to the proxy + * and do not have any longer. + */ + if (cl > 0) { + goto cleanup; + } + } + /* + * Transfer-Encoding was set as input header, so we had + * a request body. We cannot retry with a direct + * connection for the same reason as above. + */ + if (apr_table_get(r->headers_in, "Transfer-Encoding")) { + goto cleanup; + } } - /* we failed to talk to the upstream proxy */ } } }