]> granicus.if.org Git - apache/commitdiff
Adding the same filters over and over again used to be okay, because
authorRyan Bloom <rbb@apache.org>
Mon, 4 Mar 2002 05:54:44 +0000 (05:54 +0000)
committerRyan Bloom <rbb@apache.org>
Mon, 4 Mar 2002 05:54:44 +0000 (05:54 +0000)
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
modules/http/http_protocol.c

index cbd05a6ac823fc15c84bae35981379ae430c437e..fcd7029e09919bfab1b03e85e19ee824d18c2898 100644 (file)
@@ -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,
index c647de8d0073223a5de3a1512015162c65c25a3d..f4f91ad93213a11951a57e5df3cd90dd5583e9d7 100644 (file)
@@ -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