From 9b13772f8797ed967cefdfefc09a4f219eeba63a Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Mon, 19 Mar 2001 21:54:57 +0000 Subject: [PATCH] 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 --- CHANGES | 3 +++ modules/http/http_protocol.c | 6 ++++-- server/protocol.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index eb9a0dbe74..81d4a1dcd8 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 2eee5314ef..82e4603a79 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 4743ab8aaa..a58389a05a 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; -- 2.40.0