httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterling <sterl...@covalent.net>
Subject [PATCH] ensure the required output filters get added on failure
Date Tue, 29 May 2001 01:49:41 GMT
After discussion with graham in the previous thread, this patch should be
in the ballpark for what we decided would fix the 'no headers on error'
problem that we've been seeing - whatdyou think graham?

i am not sure if there are other required output_filters - they can be
added as required (e.g. byterange).


sterling


Index: modules/http/http_request.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.99
diff -u -r1.99 http_request.c
--- modules/http/http_request.c	2001/05/21 23:47:16	1.99
+++ modules/http/http_request.c	2001/05/29 01:43:22
@@ -91,6 +91,28 @@
 #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 @@
                         custom_response);
         }
     }
+    add_required_filters(r);
     ap_send_error_response(r, recursive_error);
 }
 





Mime
View raw message