From 45cb1e8190ab53908d0f4a41c3eab7918b2280fb Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Fri, 5 Apr 2002 17:50:37 +0000 Subject: [PATCH] This is a HACK! The problem is that the fast_internal_redirect is removing the OLD_WRITE filter. Obviously that is wrong. For right now, the fix is to hack around the problem and just make it work. Long term, we need to find a real solution to this, but this gets autoindex working today. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94457 13f79535-47bb-0310-9956-ffa450edef68 --- modules/generators/mod_autoindex.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index fc58e3ffd2..4848ffc227 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -1000,6 +1000,7 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble, apr_table_setn(hdrs, "Accept", "text/html, text/plain"); apr_table_unset(hdrs, "Accept-Encoding"); + if ((header_fname != NULL) && r->args) { header_fname = apr_pstrcat(r->pool, header_fname, "?", r->args, NULL); } @@ -1017,13 +1018,30 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble, if (rr->content_type != NULL) { if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type), "text/html")) { - /* Hope everything will work... */ + ap_filter_t *f; + /* Hope everything will work... */ emit_amble = 0; emit_H1 = 0; if (! suppress_amble) { emit_preamble(r, title); } + /* This is a hack, but I can't find any better way to do this. + * The problem is that we have already created the sub-request, + * but we just inserted the OLD_WRITE filter, and the + * sub-request needs to pass its data through the OLD_WRITE + * filter, or things go horribly wrong (missing data, data in + * the wrong order, etc). To fix it, if you create a + * sub-request and then insert the OLD_WRITE filter before you + * run the request, you need to make sure that the sub-request + * data goes through the OLD_WRITE filter. Just steal this + * code. The long-term solution is to remove the ap_r* + * functions. + */ + for (f=rr->output_filters; + f->frec != ap_subreq_core_filter_handle; f = f->next); + f->next = r->output_filters; + /* * If there's a problem running the subrequest, display the * preamble if we didn't do it before -- the header file @@ -1111,6 +1129,12 @@ static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble) if (rr->content_type != NULL) { if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type), "text/html")) { + ap_filter_t *f; + for (f=rr->output_filters; + f->frec != ap_subreq_core_filter_handle; f = f->next); + f->next = r->output_filters; + + if (ap_run_sub_req(rr) == OK) { /* worked... */ suppress_sig = 1; -- 2.40.0