]> granicus.if.org Git - apache/commitdiff
Enable ProxySet inside <Proxy> section to
authorMladen Turk <mturk@apache.org>
Wed, 2 Aug 2006 06:54:01 +0000 (06:54 +0000)
committerMladen Turk <mturk@apache.org>
Wed, 2 Aug 2006 06:54:01 +0000 (06:54 +0000)
create balancer or worker if they were not
already created.
This allows to have ProxySet directive before
BalancerMember directives inside Proxy section.

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

modules/proxy/mod_proxy.c

index 10865704fbff226ef43661dd08a335e4eeb1d144..4edc797ee712de6644ac400dd55f9659856de410 100644 (file)
@@ -1605,6 +1605,7 @@ static const char *
     proxy_balancer *balancer = NULL;
     proxy_worker *worker = NULL;
     const char *err;
+    int in_proxy_section = 0;
 
     if (cmd->directive->parent &&
         strncasecmp(cmd->directive->parent->directive,
@@ -1616,6 +1617,7 @@ static const char *
         name = ap_getword_conf(cmd->temp_pool, &pargs);
         if ((word = ap_strchr(name, '>')))
             *word = '\0';
+        in_proxy_section = 1;
     }
     else {
         /* Standard set directive with worker/balancer
@@ -1627,15 +1629,32 @@ static const char *
     if (strncasecmp(name, "balancer:", 9) == 0) {
         balancer = ap_proxy_get_balancer(cmd->pool, conf, name);
         if (!balancer) {
-            return apr_pstrcat(cmd->temp_pool, "ProxySet can not find '",
-                               name, "' Balancer.", NULL);
+            if (in_proxy_section) {
+                err = ap_proxy_add_balancer(&balancer,
+                                            cmd->pool,
+                                            conf, name);
+                if (err)
+                    return apr_pstrcat(cmd->temp_pool, "ProxySet ",
+                                       err, NULL);
+            }
+            else
+                return apr_pstrcat(cmd->temp_pool, "ProxySet can not find '",
+                                   name, "' Balancer.", NULL);
         }
     }
     else {
         worker = ap_proxy_get_worker(cmd->temp_pool, conf, name);
         if (!worker) {
-            return apr_pstrcat(cmd->temp_pool, "ProxySet can not find '",
-                               name, "' Worker.", NULL);
+            if (in_proxy_section) {
+                err = ap_proxy_add_worker(&worker, cmd->pool,
+                                          conf, name);
+                if (err)
+                    return apr_pstrcat(cmd->temp_pool, "ProxySet ",
+                                       err, NULL);
+            }
+            else
+                return apr_pstrcat(cmd->temp_pool, "ProxySet can not find '",
+                                   name, "' Worker.", NULL);
         }
     }