]> granicus.if.org Git - apache/commitdiff
Handle ap_discard_request_body() being called more than once.
authorJeff Trawick <trawick@apache.org>
Mon, 19 Mar 2001 21:54:57 +0000 (21:54 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 19 Mar 2001 21:54:57 +0000 (21:54 +0000)
Add a debug assertion to verify that c->remain is zero when a new
request starts.  ap_http_filter() does the wrong thing otherwise.

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

CHANGES
modules/http/http_protocol.c
server/protocol.c

diff --git a/CHANGES b/CHANGES
index eb9a0dbe74dea8aa43f49c006147c97f5a2e75ad..81d4a1dcd82461a9b1662af30b5dd44ce65129bf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.15-dev
 
+  *) Handle ap_discard_request_body() being called more than once.
+     [Greg Ames, Jeff Trawick]
+
   *) Get rid of an inadvertent close of file descriptor 2 in
      mod_mime_magic.  [Greg Ames, Jeff Trawick]
 
index 2eee5314efa5fc9b8c37e4404686381e0c3e0ee3..82e4603a79d0a2e86d8fbef24933fd623d15809c 100644 (file)
@@ -1450,8 +1450,10 @@ AP_DECLARE(int) ap_discard_request_body(request_rec *r)
 {
     int rv;
 
-    if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
-        return rv;
+    if (r->read_length == 0) { /* if not read already */
+        if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
+            return rv;
+    }
 
     /* In order to avoid sending 100 Continue when we already know the
      * final response status, and yet not kill the connection if there is
index 4743ab8aaa81322d62439554da132b9a7e1cab71..a58389a05a225b45e1c993714983ded53c67b6cd 100644 (file)
@@ -844,6 +844,8 @@ request_rec *ap_read_request(conn_rec *conn)
     const char *expect;
     int access_status;
 
+    AP_DEBUG_ASSERT(conn->remain == 0);
+
     apr_pool_create(&p, conn->pool);
     r = apr_pcalloc(p, sizeof(request_rec));
     r->pool            = p;