]> granicus.if.org Git - apache/commitdiff
add pre_htaccess hook; in conjunction with earlier dirwalk_stat
authorJeff Trawick <trawick@apache.org>
Mon, 24 Sep 2012 12:42:32 +0000 (12:42 +0000)
committerJeff Trawick <trawick@apache.org>
Mon, 24 Sep 2012 12:42:32 +0000 (12:42 +0000)
and post_perdir_config hooks, this should allow mpm-itk to be
used without patches to httpd core

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389339 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/http_config.h
server/config.c

diff --git a/CHANGES b/CHANGES
index 3530d2c071c8f5da044558b5e6bd6cfdf4c7b202..d9b909308fbe03e3146b69602a9cb7869d27fa2d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -9,7 +9,8 @@ Changes with Apache 2.5.0
      AuthFormLoginRequiredLocation, AuthFormLoginSuccessLocation and
      AuthFormLogoutLocation directives. [Graham Leggett]
 
-  *) core: Add dirwalk_stat hook.  [Jeff Trawick]
+  *) core: Add dirwalk_stat and pre_htaccess hooks, allowing mpm-itk
+     to be used without patches to httpd core.  [Jeff Trawick]
 
   *) mod_proxy: Allow for persistence of local changes (via the
      balancer-manager) between graceful and normal restarts.
index 617ab2a682b74f320e6d6298bbb25de27854b75a..9d6b013b5ea521ad20b690162cdd6eab76ca7376 100644 (file)
@@ -1321,6 +1321,15 @@ AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri))
  */
 AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
 
+/**
+ * Allow modules to perform a check immediately prior to opening htaccess.
+ * @param r The current request
+ * @param filename The htaccess file which will be processed
+ * @return HTTP status code to fail the operation, or DECLINED to let later
+ * modules decide
+ */
+AP_DECLARE_HOOK(int,pre_htaccess,(request_rec *r, const char *filename))
+
 /**
  * A generic pool cleanup that will reset a pointer to NULL. For use with
  * apr_pool_cleanup_register.
index fb07623b0aece1b25f8892e3c70be59f02ab03da..a9adddd75fb263321147793d642ff3619cf194b7 100644 (file)
@@ -80,6 +80,7 @@ APR_HOOK_STRUCT(
            APR_HOOK_LINK(quick_handler)
            APR_HOOK_LINK(optional_fn_retrieve)
            APR_HOOK_LINK(test_config)
+           APR_HOOK_LINK(pre_htaccess)
 )
 
 AP_IMPLEMENT_HOOK_RUN_ALL(int, header_parser,
@@ -171,6 +172,9 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(int, handler, (request_rec *r),
 AP_IMPLEMENT_HOOK_RUN_FIRST(int, quick_handler, (request_rec *r, int lookup),
                             (r, lookup), DECLINED)
 
+AP_IMPLEMENT_HOOK_RUN_FIRST(int, pre_htaccess, (request_rec *r, const char *filename),
+                            (r, filename), DECLINED)
+
 /* hooks with no args are implemented last, after disabling APR hook probes */
 #if defined(APR_HOOK_PROBES_ENABLED)
 #undef APR_HOOK_PROBES_ENABLED
@@ -2078,6 +2082,7 @@ AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
     struct htaccess_result *new;
     ap_conf_vector_t *dc = NULL;
     apr_status_t status;
+    int rc;
 
     /* firstly, search cache */
     for (cache = r->htaccess; cache != NULL; cache = cache->next) {
@@ -2104,6 +2109,10 @@ AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
          */
         filename = ap_make_full_path(r->pool, d,
                                      ap_getword_conf(r->pool, &access_name));
+        rc = ap_run_pre_htaccess(r, filename);
+        if (rc != DECLINED && rc != OK) {
+            return rc;
+        }
         status = ap_pcfg_openfile(&f, r->pool, filename);
 
         if (status == APR_SUCCESS) {