httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1809302 - in /httpd/httpd/trunk: include/ap_mmn.h include/http_config.h server/config.c
Date Fri, 22 Sep 2017 11:58:53 GMT
Author: ylavic
Date: Fri Sep 22 11:58:53 2017
New Revision: 1809302

URL: http://svn.apache.org/viewvc?rev=1809302&view=rev
Log:
config: allow to specify flags when registering modules.

First one is AP_MODULE_FLAG_ALWAYS_MERGE.


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

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1809302&r1=1809301&r2=1809302&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Fri Sep 22 11:58:53 2017
@@ -555,6 +555,7 @@
  * 20161018.5 (2.5.0-dev)  Add ap_get_basic_auth_components() and deprecate
  *                         ap_get_basic_auth_pw()
  * 20161018.6 (2.5.0-dev)  Add ap_update_sb_handle()
+ * 20161018.7 (2.5.0-dev)  Add flags field to module_struct
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
@@ -562,7 +563,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20161018
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 6                 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 7                 /* 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=1809302&r1=1809301&r2=1809302&view=diff
==============================================================================
--- httpd/httpd/trunk/include/http_config.h (original)
+++ httpd/httpd/trunk/include/http_config.h Fri Sep 22 11:58:53 2017
@@ -333,6 +333,16 @@ struct cmd_parms_struct {
     ap_directive_t *parent;
 };
 
+#define AP_MODULE_HAS_FLAGS \
+        AP_MODULE_MAGIC_AT_LEAST(20161018,7)
+#if AP_MODULE_HAS_FLAGS
+/**
+ * Flags associated with a module.
+ */
+#define AP_MODULE_FLAG_NONE         (0)
+#define AP_MODULE_FLAG_ALWAYS_MERGE (1 << 0)
+#endif
+
 /**
  * Module structures.  Just about everything is dispatched through
  * these, directly or indirectly (through the command and handler
@@ -412,6 +422,11 @@ struct module_struct {
      *  @param p the pool to use for all allocations
      */
     void (*register_hooks) (apr_pool_t *p);
+
+#if AP_MODULE_HAS_FLAGS
+    /** A bitmask of AP_MODULE_FLAG_* */
+    int flags;
+#endif
 };
 
 /**

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=1809302&r1=1809301&r2=1809302&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Fri Sep 22 11:58:53 2017
@@ -323,24 +323,36 @@ static ap_conf_vector_t *create_server_c
 }
 
 static void merge_server_configs(apr_pool_t *p, ap_conf_vector_t *base,
-                                 ap_conf_vector_t *virt)
+                                 server_rec *virt)
 {
     /* Can reuse the 'virt' vector for the spine of it, since we don't
      * have to deal with the moral equivalent of .htaccess files here...
      */
 
     void **base_vector = (void **)base;
-    void **virt_vector = (void **)virt;
+    void **virt_vector = (void **)virt->module_config;
     module *modp;
 
     for (modp = ap_top_module; modp; modp = modp->next) {
         merger_func df = modp->merge_server_config;
         int i = modp->module_index;
 
-        if (!virt_vector[i])
-            virt_vector[i] = base_vector[i];
-        else if (df)
+        if (!virt_vector[i]) {
+#if AP_MODULE_HAS_FLAGS
+            if (df && modp->create_server_config
+                   && modp->flags & AP_MODULE_FLAG_ALWAYS_MERGE) {
+                virt_vector[i] = (*modp->create_server_config)(p, virt);
+            }
+            else
+#endif
+            {
+                virt_vector[i] = base_vector[i];
+                df = NULL;
+            }
+        }
+        if (df) {
             virt_vector[i] = (*df)(p, base_vector[i], virt_vector[i]);
+        }
     }
 }
 
@@ -2334,8 +2346,7 @@ AP_DECLARE(void) ap_fixup_virtual_hosts(
     dconf->log = &main_server->log;
 
     for (virt = main_server->next; virt; virt = virt->next) {
-        merge_server_configs(p, main_server->module_config,
-                             virt->module_config);
+        merge_server_configs(p, main_server->module_config, virt);
 
         virt->lookup_defaults =
             ap_merge_per_dir_configs(p, main_server->lookup_defaults,



Mime
View raw message