You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2010/08/22 11:47:30 UTC
svn commit: r987854 - /httpd/httpd/trunk/modules/proxy/mod_proxy.c
Author: rjung
Date: Sun Aug 22 09:47:29 2010
New Revision: 987854
URL: http://svn.apache.org/viewvc?rev=987854&view=rev
Log:
Change behaviour of worker sharing.
A proxy worker is shared, if its URL is a leading substring
of the URL of another worker defined later in the configuration.
Before this change this
- triggered the "worker ... already used by another worker" message
- resulted in a hard to understand configuration for this worker
- Attributes explicitely given in the later worker overwrote
attributes in the worker which was defined first
- General proxy attributes (e.g. ProxyTimeout ) overwrote
attributes in the worker which was defined first
New behaviour:
- Talk about "sharing" of workers and log both worker URLs
in the info log message instead of the "already used" message
- Do not overwrite attributes. If attributes were explicitely
given in the later worker, log a warning that those are ignored
because of sharing.
Modified:
httpd/httpd/trunk/modules/proxy/mod_proxy.c
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=987854&r1=987853&r2=987854&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Sun Aug 22 09:47:29 2010
@@ -1395,21 +1395,30 @@ static const char *
}
else {
proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, conf, r);
+ int reuse = 0;
if (!worker) {
const char *err = ap_proxy_add_worker(&worker, cmd->pool, conf, r);
if (err)
return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL);
+ PROXY_COPY_CONF_PARAMS(worker, conf);
} else {
+ reuse = 1;
ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server,
- "worker %s already used by another worker", worker->name);
+ "Sharing worker '%s' instead of creating new worker '%s'",
+ worker->name, new->real);
}
- PROXY_COPY_CONF_PARAMS(worker, conf);
for (i = 0; i < arr->nelts; i++) {
- const char *err = set_worker_param(cmd->pool, worker, elts[i].key,
- elts[i].val);
- if (err)
- return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL);
+ if (reuse) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
+ "Ignoring parameter '%s=%s' for worker '%s' because of worker sharing",
+ elts[i].key, elts[i].val, worker->name);
+ } else {
+ const char *err = set_worker_param(cmd->pool, worker, elts[i].key,
+ elts[i].val);
+ if (err)
+ return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL);
+ }
}
}
return NULL;
@@ -1756,6 +1765,7 @@ static const char *add_member(cmd_parms
apr_table_t *params = apr_table_make(cmd->pool, 5);
const apr_array_header_t *arr;
const apr_table_entry_t *elts;
+ int reuse = 0;
int i;
if (cmd->path)
@@ -1796,19 +1806,27 @@ static const char *add_member(cmd_parms
const char *err;
if ((err = ap_proxy_add_worker(&worker, cmd->pool, conf, name)) != NULL)
return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL);
+ PROXY_COPY_CONF_PARAMS(worker, conf);
} else {
+ reuse = 1;
ap_log_error(APLOG_MARK, APLOG_INFO, 0, cmd->server,
- "worker %s already used by another worker", worker->name);
+ "Sharing worker '%s' instead of creating new worker '%s'",
+ worker->name, name);
}
- PROXY_COPY_CONF_PARAMS(worker, conf);
arr = apr_table_elts(params);
elts = (const apr_table_entry_t *)arr->elts;
for (i = 0; i < arr->nelts; i++) {
- const char *err = set_worker_param(cmd->pool, worker, elts[i].key,
- elts[i].val);
- if (err)
- return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL);
+ if (reuse) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
+ "Ignoring parameter '%s=%s' for worker '%s' because of worker sharing",
+ elts[i].key, elts[i].val, worker->name);
+ } else {
+ const char *err = set_worker_param(cmd->pool, worker, elts[i].key,
+ elts[i].val);
+ if (err)
+ return apr_pstrcat(cmd->temp_pool, "BalancerMember ", err, NULL);
+ }
}
/* Try to find the balancer */
balancer = ap_proxy_get_balancer(cmd->temp_pool, conf, path);