httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1813643 - in /httpd/httpd/trunk: CHANGES modules/core/mod_macro.c
Date Sat, 28 Oct 2017 16:05:51 GMT
Author: ylavic
Date: Sat Oct 28 16:05:51 2017
New Revision: 1813643

URL: http://svn.apache.org/viewvc?rev=1813643&view=rev
Log:
mod_macro: fix usability of globally defined macros in .htaccess files.
PR 57525.

Reverts pre_config hook from r1656669 (happens too late for EXEC_ON_READ), and
ensures ap_macros is reset on restart with a pconf cleanup.

Proposed by: Jose Kahan <jose w3.org>
Reviewed by: ylavic

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/core/mod_macro.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1813643&r1=1813642&r2=1813643&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Oct 28 16:05:51 2017
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_macro: fix usability of globally defined macros in .htaccess files.
+     PR 57525.  [Jose Kahan <jose w3.org>, Yann Ylavic]
+
   *) mod_md: v1.0.1, ServerName/Alias names from pure-http: virtual hosts are no longer
      auto-added to a Managed Domain. Error counts of jobs are presisted. When the server
      restarts (gracefully) any errored staging areas are purged to reset the signup/renewal

Modified: httpd/httpd/trunk/modules/core/mod_macro.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/core/mod_macro.c?rev=1813643&r1=1813642&r2=1813643&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/core/mod_macro.c (original)
+++ httpd/httpd/trunk/modules/core/mod_macro.c Sat Oct 28 16:05:51 2017
@@ -711,11 +711,17 @@ static const char *macro_section(cmd_par
     debug(fprintf(stderr, "macro_section: arg='%s'\n", arg));
 
     /* lazy initialization */
-    if (ap_macros == NULL)
-        ap_macros = apr_hash_make(cmd->temp_pool);
-    ap_assert(ap_macros != NULL);
-
-    pool = apr_hash_pool_get(ap_macros);
+    if (ap_macros == NULL) {
+        pool = cmd->pool;
+        ap_macros = apr_hash_make(pool);
+        ap_assert(ap_macros != NULL);
+        apr_pool_cleanup_register(pool, &ap_macros,
+                                  ap_pool_cleanup_set_null,
+                                  apr_pool_cleanup_null);
+    }
+    else {
+        pool = apr_hash_pool_get(ap_macros);
+    }
 
     endp = (char *) ap_strrchr_c(arg, '>');
 
@@ -954,12 +960,6 @@ static const char *macro_ignore_bad_nest
 	return NULL;
 }
 
-static int macro_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
-{
-    ap_macros = NULL;
-    return OK;
-}
-
 /************************************************************* EXPORT MODULE */
 
 /*
@@ -982,11 +982,6 @@ static const command_rec macro_cmds[] =
     {NULL}
 };
 
-static void macro_hooks(apr_pool_t *p)
-{
-    ap_hook_pre_config(macro_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
-}
-
 /*
   Module hooks are request-oriented thus it does not suit configuration
   file utils a lot. I haven't found any clean hook to apply something
@@ -1004,5 +999,5 @@ AP_DECLARE_MODULE(macro) = {
         NULL,                   /* create per-server config structure */
         NULL,                   /* merge per-server config structures */
         macro_cmds,             /* configuration commands */
-        macro_hooks             /* register hooks */
+        NULL                    /* register hooks */
 };



Mime
View raw message