From: Ryan Bloom Date: Thu, 2 Aug 2001 05:27:06 +0000 (+0000) Subject: Add a handler to mod_includes.c. This handler is designed to X-Git-Tag: 2.0.23~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b60b9bec231c403a61f3c5bd82cff16e799196a9;p=apache 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 --- diff --git a/CHANGES b/CHANGES index 3a359c42ee..26dd0c0c61 100644 --- a/CHANGES +++ b/CHANGES @@ -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); }