You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2012/09/20 15:41:46 UTC

svn commit: r1388029 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml include/ap_mmn.h modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h

Author: jim
Date: Thu Sep 20 13:41:45 2012
New Revision: 1388029

URL: http://svn.apache.org/viewvc?rev=1388029&view=rev
Log:
OK, enable/allow previous broken, bad behavior iff the user
really, really wants it. And warn that b-m isn't recommended
in those cases.

Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.h

Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml?rev=1388029&r1=1388028&r2=1388029&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml Thu Sep 20 13:41:45 2012
@@ -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>

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=1388029&r1=1388028&r2=1388029&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Thu Sep 20 13:41:45 2012
@@ -400,7 +400,7 @@
  * 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" */

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1388029&r1=1388028&r2=1388029&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Thu Sep 20 13:41:45 2012
@@ -1173,13 +1173,24 @@ static void * merge_proxy_config(apr_poo
     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
     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,

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1388029&r1=1388028&r2=1388029&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Thu Sep 20 13:41:45 2012
@@ -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;