Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6FCF1200D01 for ; Fri, 22 Sep 2017 13:58:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 6E1DF1609BE; Fri, 22 Sep 2017 11:58:59 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B23E51609A7 for ; Fri, 22 Sep 2017 13:58:58 +0200 (CEST) Received: (qmail 48733 invoked by uid 500); 22 Sep 2017 11:58:57 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 48724 invoked by uid 99); 22 Sep 2017 11:58:57 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Sep 2017 11:58:57 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id A6F6C3A00E9 for ; Fri, 22 Sep 2017 11:58:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: cvs@httpd.apache.org From: ylavic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170922115856.A6F6C3A00E9@svn01-us-west.apache.org> archived-at: Fri, 22 Sep 2017 11:58:59 -0000 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,