On Fri, Jul 11, 2014 at 12:36 PM, <[email protected]> wrote:
> Author: jkaluza
> Date: Fri Jul 11 10:36:15 2014
> New Revision: 1609680
>
> URL: http://svn.apache.org/r1609680
> Log:
> mod_proxy: add ap_proxy_define_match_worker() and use it for ProxyPassMatch
> and ProxyMatch section to distinguish between normal workers and workers
> with regex substitutions in the name. Implement handling of such workers
> in ap_proxy_get_worker(). PR 43513
>
[...]
> --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Jul 11 10:36:15 2014
> @@ -1647,15 +1647,30 @@ static const char *
> new->balancer = balancer;
> }
> else {
> - proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL,
> conf, de_socketfy(cmd->pool, r));
> + proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL,
> conf, new->real);
> int reuse = 0;
> if (!worker) {
> - const char *err = ap_proxy_define_worker(cmd->pool, &worker,
> NULL, conf, r, 0);
> + const char *err;
> + if (use_regex) {
> + err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL,
> + conf, r, 0);
> + }
> + else {
> + err = ap_proxy_define_worker(cmd->pool, &worker, NULL,
> + conf, r, 0);
> + }
> if (err)
> return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL);
>
> PROXY_COPY_CONF_PARAMS(worker, conf);
> - } else {
> + }
> + else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) {
Maybe (worker->s->is_name_matchable != 0)?
> + return apr_pstrcat(cmd->temp_pool, "ProxyPass/<Proxy> and "
> + "ProxyPassMatch/<ProxyMatch> can't be used "
> + "altogether with the same worker name ",
> + "(", worker->s->name, ")", NULL);
> + }
> + else {
> reuse = 1;
> ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server,
> APLOGNO(01145)
> "Sharing worker '%s' instead of creating new worker
> '%s'",
[...]
> @@ -2354,12 +2371,24 @@ static const char *proxysection(cmd_parm
> worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf,
> de_socketfy(cmd->temp_pool,
> (char*)conf->p));
> if (!worker) {
> - err = ap_proxy_define_worker(cmd->pool, &worker, NULL,
> - sconf, conf->p, 0);
> + if (use_regex) {
> + err = ap_proxy_define_match_worker(cmd->pool, &worker,
> NULL,
> + sconf, conf->p, 0);
> + }
> + else {
> + err = ap_proxy_define_worker(cmd->pool, &worker, NULL,
> + sconf, conf->p, 0);
> + }
> if (err)
> return apr_pstrcat(cmd->temp_pool, thiscmd->name,
> " ", err, NULL);
> }
> + else if ((use_regex != 0) ^ (worker->s->is_name_matchable)) {
Likewise?
> + return apr_pstrcat(cmd->temp_pool, "ProxyPass/<Proxy> and "
> + "ProxyPassMatch/<ProxyMatch> can't be
> used "
> + "altogether with the same worker name ",
> + "(", worker->s->name, ")", NULL);
> + }