httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1498880 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/http_config.h server/config.c server/core.c
Date Tue, 02 Jul 2013 11:26:41 GMT
Author: sf
Date: Tue Jul  2 11:26:41 2013
New Revision: 1498880

URL: http://svn.apache.org/r1498880
Log:
Replace pre_htaccess hook with more flexible open_htaccess hook

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/http_config.h
    httpd/httpd/trunk/server/config.c
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1498880&r1=1498879&r2=1498880&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Jul  2 11:26:41 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: Replace pre_htaccess hook with more flexible open_htaccess hook.
+     [Stefan Fritsch]
+
   *) mod_authnz_ldap: Support primitive LDAP servers that do not accept
      filters, such as "SDBM-backed LDAP" on z/OS, by allowing a special
      filter "none" to be specified in AuthLDAPURL. [Eric Covener]

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1498880&r1=1498879&r2=1498880&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Tue Jul  2 11:26:41 2013
@@ -434,14 +434,15 @@
  * 20121222.14 (2.5.0-dev) Add ap_map_http_request_error()
  * 20121222.15 (2.5.0-dev) Add allow/decode_encoded_slashes_set to core_dir_config
  * 20121222.16 (2.5.0-dev) AP_DEFAULT_HANDLER_NAME/AP_IS_DEAULT_HANDLER_NAME
+ * 20130702.0 (2.5.0-dev)  Remove pre_htaccess hook, add open_htaccess hook.
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20121222
+#define MODULE_MAGIC_NUMBER_MAJOR 20130702
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 16                  /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 0                  /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/http_config.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/http_config.h?rev=1498880&r1=1498879&r2=1498880&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_config.h (original)
+++ httpd/httpd/trunk/include/http_config.h Tue Jul  2 11:26:41 2013
@@ -1322,13 +1322,29 @@ AP_DECLARE_HOOK(int,quick_handler,(reque
 AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
 
 /**
- * Allow modules to perform a check immediately prior to opening htaccess.
+ * Allow modules to open htaccess files or perform operations before doing so
  * @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
+ * @param dir_name The directory for which the htaccess file should be opened
+ * @param access_name The filename  for which the htaccess file should be opened
+ * @param conffile Where the pointer to the opened ap_configfile_t must be
+ *        stored
+ * @param full_name Where the full file name of the htaccess file must be
+ *        stored.
+ * @return APR_SUCCESS on success,
+ *         APR_ENOENT or APR_ENOTDIR if no htaccess file exists,
+ *         AP_DECLINED to let later modules do the opening,
+ *         any other error code on error.
  */
-AP_DECLARE_HOOK(int,pre_htaccess,(request_rec *r, const char *filename))
+AP_DECLARE_HOOK(apr_status_t,open_htaccess,
+                (request_rec *r, const char *dir_name, const char *access_name,
+                 ap_configfile_t **conffile, const char **full_name))
+
+/**
+ * Core internal function, use ap_run_open_htaccess() instead.
+ */
+apr_status_t ap_open_htaccess(request_rec *r, const char *dir_name,
+        const char *access_name, ap_configfile_t **conffile,
+        const char **full_name);
 
 /**
  * A generic pool cleanup that will reset a pointer to NULL. For use with

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1498880&r1=1498879&r2=1498880&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Tue Jul  2 11:26:41 2013
@@ -80,7 +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)
+           APR_HOOK_LINK(open_htaccess)
 )
 
 AP_IMPLEMENT_HOOK_RUN_ALL(int, header_parser,
@@ -172,8 +172,11 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(int, handler
 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)
+AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, open_htaccess,
+                            (request_rec *r, const char *dir_name, const char *access_name,
+                             ap_configfile_t **conffile, const char **full_name),
+                            (r, dir_name, access_name, conffile, full_name),
+                            AP_DECLINED)
 
 /* hooks with no args are implemented last, after disabling APR hook probes */
 #if defined(APR_HOOK_PROBES_ENABLED)
@@ -2074,19 +2077,27 @@ AP_DECLARE(int) ap_process_config_tree(s
     return OK;
 }
 
+apr_status_t ap_open_htaccess(request_rec *r, const char *dir_name,
+                              const char *access_name,
+                              ap_configfile_t **conffile,
+                              const char **full_name)
+{
+    *full_name = ap_make_full_path(r->pool, dir_name, access_name);
+    return ap_pcfg_openfile(conffile, r->pool, *full_name);
+}
+
 AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
                                        request_rec *r, int override,
                                        int override_opts, apr_table_t *override_list,
-                                       const char *d, const char *access_name)
+                                       const char *d, const char *access_names)
 {
     ap_configfile_t *f = NULL;
     cmd_parms parms;
-    char *filename = NULL;
+    const char *filename;
     const struct htaccess_result *cache;
     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) {
@@ -2106,19 +2117,11 @@ AP_CORE_DECLARE(int) ap_parse_htaccess(a
     parms.path = apr_pstrdup(r->pool, d);
 
     /* loop through the access names and find the first one */
-    while (access_name[0]) {
-        /* AFAICT; there is no use of the actual 'filename' against
-         * any canonicalization, so we will simply take the given
-         * name, ignoring case sensitivity and aliases
-         */
-        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);
+    while (access_names[0]) {
+        const char *access_name = ap_getword_conf(r->pool, &access_names);
 
+        filename = NULL;
+        status = ap_run_open_htaccess(r, d, access_name, &f, &filename);
         if (status == APR_SUCCESS) {
             const char *errmsg;
             ap_directive_t *temptree = NULL;

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1498880&r1=1498879&r2=1498880&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Tue Jul  2 11:26:41 2013
@@ -5047,6 +5047,7 @@ static void register_hooks(apr_pool_t *p
     ap_hook_insert_network_bucket(core_insert_network_bucket, NULL, NULL,
                                   APR_HOOK_REALLY_LAST);
     ap_hook_dirwalk_stat(core_dirwalk_stat, NULL, NULL, APR_HOOK_REALLY_LAST);
+    ap_hook_open_htaccess(ap_open_htaccess, NULL, NULL, APR_HOOK_REALLY_LAST);
     
     /* register the core's insert_filter hook and register core-provided
      * filters



Mime
View raw message