Commit 8ed59466 authored by Mladen Turk's avatar Mladen Turk
Browse files

Enable ProxySet inside <Proxy> section to

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
parent 34a5dc8e
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -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,6 +1629,15 @@ static const char *
    if (strncasecmp(name, "balancer:", 9) == 0) {
        balancer = ap_proxy_get_balancer(cmd->pool, conf, name);
        if (!balancer) {
            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);
        }
@@ -1634,6 +1645,14 @@ static const char *
    else {
        worker = ap_proxy_get_worker(cmd->temp_pool, conf, name);
        if (!worker) {
            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);
        }