You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by sterling <st...@covalent.net> on 2001/11/10 02:27:50 UTC
[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);
}
Re: [PATCH] headers not sent when subrequests come from ap_die
Posted by sterling <st...@covalent.net>.
I realized I didn't give a specific reproducable case here (since I had
already found the problem):
try turning on Authentication for <Location /> - that way you will get a
401 while trying to serve up the 401 ErrorDocument
(ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var).
You will see that you get a 401 error back, but no headers... which is
bad.
That is assuming you are using the default httpd.conf that has all the
ErrorDocument stuff in it and mod_include is enabled.
sterling
On Fri, 9 Nov 2001, sterling wrote:
> 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);
> }
>
>
>