]> granicus.if.org Git - apache/commitdiff
OK, enable/allow previous broken, bad behavior iff the user
authorJim Jagielski <jim@apache.org>
Thu, 20 Sep 2012 13:41:45 +0000 (13:41 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 20 Sep 2012 13:41:45 +0000 (13:41 +0000)
really, really wants it. And warn that b-m isn't recommended
in those cases.

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

docs/manual/mod/mod_proxy.xml
include/ap_mmn.h
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h

index 4f8c820bdcaa5ee87bb1458d3e4aacb378af6de4..56def6edd023f769687f0b984405c19f8181d278 100644 (file)
@@ -665,6 +665,21 @@ expressions</description>
     </usage>
 </directivesynopsis>
     
+<directivesynopsis>
+    <name>BalancerInherit</name>
+    <description>Inherit Balancers from the main server</description>
+    <syntax>BalancerInherit On|Off</syntax>
+    <default>BalancerInherit Off</default>
+    <contextlist><context>server config</context><context>virtual host</context></contextlist>
+    <compatibility>BalancerInherit is only available in Apache HTTP Server 2.5.0
+        and later.</compatibility>
+    <usage>
+        <p>This directive will cause the current server/vhost to "inherit" Balancers
+            defined in the main server. This can cause issues and inconsistent
+            behavior if using the Balancer Manager and so is disabled
+            by default.</p>
+    </usage>
+</directivesynopsis>
 
 <directivesynopsis>
     <name>BalancerMember</name>
index 9c42f11b85a9bc5740a5e7dcec1b66b258800515..a39d86a00b7107d170304ceb559e8a31c49a7019 100644 (file)
  * 20120724.0 (2.5.0-dev)  Add hostname argument to ap_proxy_checkproxyblock.
  * 20120724.1 (2.5.0-dev)  Add post_perdir_config hook.
  * 20120724.2 (2.5.0-dev)  Add fgrab slotmem function to struct
- * 20120724.3 (2.5.0-dev)  Add bal_persist to proxy_server_conf
+ * 20120724.3 (2.5.0-dev)  Add bal_persist, inherit to proxy_server_conf
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
index ee0772753137c847a0855ef11227ae1e31b936ad..3ac3e3c4a1754448c755c3de6a89a1d442fb592c 100644 (file)
@@ -1173,13 +1173,24 @@ static void * merge_proxy_config(apr_pool_t *p, void *basev, void *overridesv)
     proxy_server_conf *base = (proxy_server_conf *) basev;
     proxy_server_conf *overrides = (proxy_server_conf *) overridesv;
 
-    ps->proxies = overrides->proxies;
-    ps->sec_proxy = overrides->sec_proxy;
-    ps->aliases = overrides->aliases;
-    ps->noproxies = overrides->noproxies;
-    ps->dirconn = overrides->dirconn;
-    ps->workers = overrides->workers;
-    ps->balancers = overrides->balancers;
+    if (overrides->inherit || base->inherit) {
+        ps->proxies = apr_array_append(p, base->proxies, overrides->proxies);
+        ps->sec_proxy = apr_array_append(p, base->sec_proxy, overrides->sec_proxy);
+        ps->aliases = apr_array_append(p, base->aliases, overrides->aliases);
+        ps->noproxies = apr_array_append(p, base->noproxies, overrides->noproxies);
+        ps->dirconn = apr_array_append(p, base->dirconn, overrides->dirconn);
+        ps->workers = apr_array_append(p, base->workers, overrides->workers);
+        ps->balancers = apr_array_append(p, base->balancers, overrides->balancers);
+    }
+    else {
+        ps->proxies = overrides->proxies;
+        ps->sec_proxy = overrides->sec_proxy;
+        ps->aliases = overrides->aliases;
+        ps->noproxies = overrides->noproxies;
+        ps->dirconn = overrides->dirconn;
+        ps->workers = overrides->workers;
+        ps->balancers = overrides->balancers;
+    }
     ps->forward = overrides->forward ? overrides->forward : base->forward;
     ps->reverse = overrides->reverse ? overrides->reverse : base->reverse;
 
@@ -1877,6 +1888,15 @@ static const char *set_persist(cmd_parms *parms, void *dummy, int flag)
     return NULL;
 }
 
+static const char *set_inherit(cmd_parms *parms, void *dummy, int flag)
+{
+    proxy_server_conf *psf =
+    ap_get_module_config(parms->server->module_config, &proxy_module);
+
+    psf->inherit = flag;
+    return NULL;
+}
+
 static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
 {
     server_rec *s = cmd->server;
@@ -2266,6 +2286,9 @@ static const command_rec proxy_cmds[] =
      "Number of additional Balancers that can be added post-config"),
     AP_INIT_FLAG("BalancerPersist", set_persist, NULL, RSRC_CONF,
      "on if the balancer should persist changes on reboot/restart made via the Balancer Manager"),
+    AP_INIT_FLAG("BalancerInherit", set_persist, NULL, RSRC_CONF,
+     "on if this server should inherit Balancers defined in the main server "
+     "(Not recommended if using the Balancer Manager)"),
     AP_INIT_TAKE1("ProxyStatus", set_status_opt, NULL, RSRC_CONF,
      "Configure Status: proxy status to one of: on | off | full"),
     AP_INIT_RAW_ARGS("ProxySet", set_proxy_param, NULL, RSRC_CONF|ACCESS_CONF,
index f1b64d6daa6b148b847814250234d17fe11e905c..9fd18d8f189fd319c3ed56c33bc732a17bad99c2 100644 (file)
@@ -179,6 +179,7 @@ typedef struct {
     unsigned int source_address_set:1;
     unsigned int bgrowth_set:1;
     unsigned int bal_persist:1;
+    unsigned int inherit:1;
 } proxy_server_conf;