From: Jeff Trawick Date: Mon, 19 Mar 2001 21:54:57 +0000 (+0000) Subject: Handle ap_discard_request_body() being called more than once. X-Git-Tag: 2.0.15~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b13772f8797ed967cefdfefc09a4f219eeba63a;p=thirdparty%2Fapache%2Fhttpd.git Handle ap_discard_request_body() being called more than once. 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 --- diff --git a/CHANGES b/CHANGES index eb9a0dbe74d..81d4a1dcd82 100644 --- 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] diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 2eee5314efa..82e4603a79d 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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 diff --git a/server/protocol.c b/server/protocol.c index 4743ab8aaa8..a58389a05a2 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -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;