]> granicus.if.org Git - apache/commitdiff
When doing a GET of a proxied URL as a subrequest within
authorBrian Pane <brianp@apache.org>
Fri, 8 Nov 2002 09:24:00 +0000 (09:24 +0000)
committerBrian Pane <brianp@apache.org>
Fri, 8 Nov 2002 09:24:00 +0000 (09:24 +0000)
a POSTed request, don't send the original POST's Content-Length
as part of the header for the GET.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97455 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/proxy_http.c

diff --git a/CHANGES b/CHANGES
index 0a2425db751e05fb4443d508bf11f747f5c03e48..6b43a82a6da1640bdcb98b750b93aba351d2f3ee 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.44
 
+  *) Fix a bug in which mod_proxy sent an invalid Content-Length
+     when a proxied URL was invoked as a server-side include within
+     a page generated in response to a form POST.  [Brian Pane]
+
   *) Added code to process min and max file size directives and to
      init the expirychk flag in mod_disk_cache. Added a clarifying
      comment to cache_util.   [Paul J. Reder]
index ee80c67d3c3056af60983eb0a5c187726277e35d..4720e7fe91ed800dcbffd414c72573783b61faba 100644 (file)
@@ -597,8 +597,27 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r,
                      || !apr_strnatcasecmp(headers_in[counter].key, "If-None-Match")) {
                     continue;
                 }
+
+                /* If you POST to a page that gets server-side parsed
+                 * by mod_include, and the parsing results in a reverse
+                 * proxy call, the proxied request will be a GET, but
+                 * its request_rec will have inherited the Content-Length
+                 * of the original request (the POST for the enclosing
+                 * page).  We can't send the original POST's request body
+                 * as part of the proxied subrequest, so we need to avoid
+                 * sending the corresponding content length.  Otherwise,
+                 * the server to which we're proxying will sit there
+                 * forever, waiting for a request body that will never
+                 * arrive.
+                 */
+                if ((r->method_number == M_GET) && headers_in[counter].key &&
+                    !apr_strnatcasecmp(headers_in[counter].key,
+                                       "Content-Length")) {
+                    continue;
+                }
         }
 
+
         buf = apr_pstrcat(p, headers_in[counter].key, ": ",
                           headers_in[counter].val, CRLF,
                           NULL);