diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2001-10-20 20:54:54 +0200 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2001-10-20 20:54:54 +0200 |
commit | 1338b5aa68deec98f8d552dd016e5cce1afb1c20 (patch) | |
tree | c6aded26fd711ac1541d0bb52fbfd152b7f0b19a /modules | |
parent | Canonicalize all absolute <Directory > sections, not simply those that (diff) | |
download | apache2-1338b5aa68deec98f8d552dd016e5cce1afb1c20.tar.xz apache2-1338b5aa68deec98f8d552dd016e5cce1afb1c20.zip |
Restrict by content type and encoding before we go and try to drag in some
text to merge as headers and footers to autoindex pages. This will escape
index.gif from a bold attempt to use IndexHeader index ;)
Also pass in the args to the subrequest, for anyone trying to decode what
the user is looking at. A great example of this coming up.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/generators/mod_autoindex.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 59c1135a44..38d43e5202 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -984,21 +984,32 @@ static void do_emit_plain(request_rec *r, apr_file_t *f) static void emit_head(request_rec *r, char *header_fname, int suppress_amble, char *title) { + apr_table_t *hdrs = r->headers_in; apr_file_t *f = NULL; request_rec *rr = NULL; int emit_amble = 1; int emit_H1 = 1; + const char *r_accept; + const char *r_accept_enc; /* * If there's a header file, send a subrequest to look for it. If it's - * found and a text file, handle it -- otherwise fall through and - * pretend there's nothing there. + * found and html do the subrequest, otherwise handle it */ + r_accept = apr_table_get(hdrs, "Accept"); + r_accept_enc = apr_table_get(hdrs, "Accept-Encoding"); + 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); + } + if ((header_fname != NULL) - && (rr = ap_sub_req_lookup_uri(header_fname, r, NULL)) + && (rr = ap_sub_req_lookup_uri(header_fname , r, NULL)) && (rr->status == HTTP_OK) && (rr->filename != NULL) - && rr->finfo.filetype == APR_REG) { + && (rr->finfo.filetype == APR_REG)) { /* * Check for the two specific cases we allow: text/html and * text/anything-else. The former is allowed to be processed for @@ -1044,6 +1055,14 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble, } } + if (r_accept) + apr_table_setn(hdrs, "Accept", r_accept); + else + apr_table_unset(hdrs, "Accept"); + + if (r_accept_enc) + apr_table_setn(hdrs, "Accept-Encoding", r_accept_enc); + if (emit_amble) { emit_preamble(r, title); } |