]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Add a check to ap_die() to make sure the filter stack is sane and
authorGraham Leggett <minfrin@apache.org>
Fri, 1 Jun 2001 17:35:07 +0000 (17:35 +0000)
committerGraham Leggett <minfrin@apache.org>
Fri, 1 Jun 2001 17:35:07 +0000 (17:35 +0000)
contains the correct basic filters when an error occurs. This fixes
a problem where headers are not being sent on error.
PR:
Obtained from:
Submitted by: John Sterling
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89253 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http/http_request.c

diff --git a/CHANGES b/CHANGES
index 349eac2bb4d024128f66153eef40b6535e626299..eaf78496b53b7a847adcb938b1204da925c67464 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,9 @@
 Changes with Apache 2.0.19-dev
+
+  *) Add a check to ap_die() to make sure the filter stack is sane and
+     contains the correct basic filters when an error occurs. This fixes
+     a problem where headers are not being sent on error. [John Sterling]
+
   *) New Header directive 'echo' option. "Header echo regex" will
      cause any headers received on the request that match regex to be
      echoed to (included in) the response headers.
index 735c1e6d72bf74bf102f1187b462c8fa552e470d..cfb9eeeb25555ee13eb345c00412f8c94d9a70e1 100644 (file)
 #include <stdarg.h>
 #endif
 
+static void add_required_filters(request_rec *r)
+{
+    ap_filter_t *f = r->output_filters;
+    int has_core = 0, has_content = 0, has_http_header = 0;
+    while (f) {
+        if(!strcasecmp(f->frec->name, "CORE"))
+            has_core = 1; 
+        else if(!strcasecmp(f->frec->name, "CONTENT_LENGTH"))
+            has_content = 1; 
+        else if(!strcasecmp(f->frec->name, "HTTP_HEADER")) 
+            has_http_header = 1;
+        f = f->next;
+    }
+    if(!has_core) 
+        ap_add_output_filter("CORE", NULL, r, r->connection);
+    if(!has_content)
+        ap_add_output_filter("CONTENT_LENGTH", NULL, r, r->connection);
+    if(!has_http_header) 
+        ap_add_output_filter("HTTP_HEADER", NULL, r, r->connection);
+
+}
+
 /*****************************************************************
  *
  * Mainline request processing...
@@ -201,6 +223,7 @@ AP_DECLARE(void) ap_die(int type, request_rec *r)
                         custom_response);
         }
     }
+    add_required_filters(r);
     ap_send_error_response(r, recursive_error);
 }