From 6cbb0419133f345370c7615f65aa8cad3725191d Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Mon, 4 Mar 2002 05:54:44 +0000 Subject: [PATCH] Adding the same filters over and over again used to be okay, because we would lose the extra filters. Now, if a filter is added, it is run. Unfortunately, this can cause an infinite loop, or it can cause request headers to appear twice. This commit removes two instances in the core where we were inserting filters for a second and third time. The bug was that error responses were causing infinite loops. This also removes the reset_filters function, which did the exact same thing as add_required_filters. The two functions were both called in error conditions, which was part of what caused this bug. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93693 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_core.c | 2 +- modules/http/http_protocol.c | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/modules/http/http_core.c b/modules/http/http_core.c index cbd05a6ac8..fcd7029e09 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -304,7 +304,7 @@ static int ap_process_http_connection(conn_rec *c) static void ap_http_insert_filter(request_rec *r) { - if (!r->main) { + if (!r->main && !r->prev) { ap_add_output_filter_handle(ap_byterange_filter_handle, NULL, r, r->connection); ap_add_output_filter_handle(ap_content_length_filter_handle, diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index c647de8d00..f4f91ad932 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1843,16 +1843,6 @@ static const char *get_canned_error_string(int status, } } -static void reset_filters(request_rec *r) -{ - /* only reset request level filters, - * connection level filters need to remain in tact - */ - r->output_filters = r->connection->output_filters; - ap_add_output_filter("CONTENT_LENGTH", NULL, r, r->connection); - ap_add_output_filter("HTTP_HEADER", NULL, r, r->connection); -} - /* We should have named this send_canned_response, since it is used for any * response that can be generated by the server from the request record. * This includes all 204 (no content), 3xx (redirect), 4xx (client error), @@ -1870,7 +1860,6 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error) * this value. */ r->eos_sent = 0; - reset_filters(r); /* * It's possible that the Location field might be in r->err_headers_out -- 2.40.0