]> granicus.if.org Git - apache/commitdiff
Add a handler to mod_includes.c. This handler is designed to
authorRyan Bloom <rbb@apache.org>
Thu, 2 Aug 2001 05:27:06 +0000 (05:27 +0000)
committerRyan Bloom <rbb@apache.org>
Thu, 2 Aug 2001 05:27:06 +0000 (05:27 +0000)
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

CHANGES
modules/filters/mod_include.c

diff --git a/CHANGES b/CHANGES
index 3a359c42ee8c5326a2de18cea6b6aa65ef7fa3b0..26dd0c0c6174dfde19af3b5facb4d80209f74b38 100644 (file)
--- 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
index 458b080be4a58853cbdc6de582ba2daef910deb1..fa822d99853bfc76f162e1165901d68a40c86574 100644 (file)
@@ -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);
 }