diff options
author | Ryan Bloom <rbb@apache.org> | 2001-08-02 05:27:06 +0000 |
---|---|---|
committer | Ryan Bloom <rbb@apache.org> | 2001-08-02 05:27:06 +0000 |
commit | b60b9bec231c403a61f3c5bd82cff16e799196a9 (patch) | |
tree | ab39e00d3db57458630e11907eb139b1abb7926d | |
parent | 7dbda3a1034c89132bb7207e75cd5c41d7c37ed7 (diff) | |
download | httpd-b60b9bec231c403a61f3c5bd82cff16e799196a9.tar.gz |
Add a handler to mod_includes.c. This handler is designed to
implement the XbitHack directive. This can't be done with a
fixup, because we need to check the content-type, which is
only available in the handler phase.
PR: 7751
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89872 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | modules/filters/mod_include.c | 30 |
2 files changed, 35 insertions, 0 deletions
@@ -1,5 +1,10 @@ Changes with Apache 2.0.23-dev + *) Add a handler to mod_includes.c. This handler is designed to + implement the XbitHack directive. This can't be done with a + fixup, because we need to check the content-type, which is + only available in the handler phase. [Ryan Bloom] + *) Make the includes filter check return codes from filters lower in the filter chain. If a lower level filter returns an error, then the request needs to stop immediately. This allows mod_include to diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 458b080be4..fa822d9985 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -2816,12 +2816,42 @@ static const command_rec includes_cmds[] = {NULL} }; +static int xbithack_handler(request_rec *r) +{ +#if defined(OS2) || defined(WIN32) || defined(NETWARE) + /* OS/2 dosen't currently support the xbithack. This is being worked on. */ + return DECLINED; +#else + enum xbithack *state; + + if (ap_strcmp_match(r->handler, "text/html")) { + return DECLINED; + } + if (!(r->finfo.protection & APR_UEXECUTE)) { + return DECLINED; + } + + state = (enum xbithack *) ap_get_module_config(r->per_dir_config, + &include_module); + + if (*state == xbithack_off) { + return DECLINED; + } + /* We always return declined, because the default handler will actually + * serve the file. All we have to do is add the filter. + */ + ap_add_output_filter("INCLUDES", NULL, r, r->connection); + return DECLINED; +#endif +} + static void register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(ap_ssi_get_tag_and_value); APR_REGISTER_OPTIONAL_FN(ap_ssi_parse_string); APR_REGISTER_OPTIONAL_FN(ap_register_include_handler); ap_hook_post_config(include_post_config, NULL, NULL, APR_HOOK_REALLY_FIRST); + ap_hook_handler(xbithack_handler, NULL, NULL, APR_HOOK_MIDDLE); ap_register_output_filter("INCLUDES", includes_filter, AP_FTYPE_CONTENT); } |