httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterling <sterl...@covalent.net>
Subject [PATCH] headers not sent when subrequests come from ap_die (fwd)
Date Mon, 12 Nov 2001 06:02:01 GMT

I'm forwarding this on cuz 2 days later it still hasn't shown up.

sterling

---------- Forwarded message ----------
Date: Fri, 9 Nov 2001 17:27:50 -0800 (PST)
From: sterling <sterling@covalent.net>
To: dev@httpd.apache.org
Subject: [PATCH] headers not sent when subrequests come from ap_die

Hi -

I have run across a situation where the header filters are not inserted
(when using ErrorDocument).  Back in the day we added the
add_required_filters call to ap_die to handle the scenario where the
request cycle didn't quite get to the insert_filters phase.  Problem is we
add those filters to the request.  However, the filter chain that is called is the one from
the
last request (e.g. r->next) - Soooo, in the right scenario, the header
filters are not added to the right filter chain, hence no headers are
written back to the client.

here is a fix that works for me.  any comments?


sterling



Index: modules/http/http_request.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.117
diff -u -r1.117 http_request.c
--- modules/http/http_request.c	2001/10/30 19:21:41	1.117
+++ modules/http/http_request.c	2001/11/10 00:13:24
@@ -123,7 +123,8 @@
     int error_index = ap_index_of_response(type);
     char *custom_response = ap_response_code_string(r, error_index);
     int recursive_error = 0;
-
+    request_rec *cur;
+
     if (type == AP_FILTER_ERROR) {
         return;
     }
@@ -223,7 +224,14 @@
                         custom_response);
         }
     }
-    add_required_filters(r);
+
+    /* need to add the filters to the last request in the chain,
+       cuz thats the one that's called later on.
+    */
+    cur = r;
+    while( cur->next )
+        cur = cur->next;
+    add_required_filters(cur);
     ap_send_error_response(r, recursive_error);
 }




Mime
View raw message