From c9163b9bdf2c2c50851d3d23e446699ea0b309a9 Mon Sep 17 00:00:00 2001 From: Justin Erenkrantz Date: Fri, 31 May 2002 07:37:19 +0000 Subject: [PATCH] Fix the case where we generate both a 401 and 413 and we go bonkers. - If an error would drop the connection, we do not return the top-level error anymore as we will assume this new one takes precedence over the original error. This also ensures that we will not read the input body (which is the point of returning these special error messages in the first place). - The ap_discard_request_body return value in ap_die() must be checked to make sure we don't encounter this recursive case and print two errors. Kudos to Jeff Trawick for his sample input which pointed this out. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95426 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_request.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 22c7d7861a..c29a32033f 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -117,8 +117,7 @@ AP_DECLARE(void) ap_die(int type, request_rec *r) * error condition, we just report on the original error, and give up on * any attempt to handle the other thing "intelligently"... */ - - if (r->status != HTTP_OK) { + if (r->status != HTTP_OK && !ap_status_drops_connection(type)) { recursive_error = type; while (r->prev && (r->prev->status != HTTP_OK)) @@ -149,8 +148,13 @@ AP_DECLARE(void) ap_die(int type, request_rec *r) else if ((r->status != HTTP_NOT_MODIFIED) && (r->status != HTTP_NO_CONTENT) && r->connection && (r->connection->keepalive != -1)) { - - (void) ap_discard_request_body(r); + /* If the discard returns AP_FILTER_ERROR, it means that we went + * recursive on ourselves and we should abort. + */ + int errstatus = ap_discard_request_body(r); + if (errstatus == AP_FILTER_ERROR) { + return; + } } /* -- 2.50.1