1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Use RAW_ARGS instead ITERATE.

Add options for connection pool when using ProxyPass

Submitted by: mturk


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William A. Rowe Jr
2004-08-11 21:30:57 +00:00
parent 8dda80bccc
commit 386cc09c53

View File

@@ -739,28 +739,70 @@ static const char *
} }
static const char * static const char *
add_pass(cmd_parms *cmd, void *dummy, const char *f, const char *r) add_pass(cmd_parms *cmd, void *dummy, const char *arg)
{ {
server_rec *s = cmd->server; server_rec *s = cmd->server;
proxy_server_conf *conf = proxy_server_conf *conf =
(proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
struct proxy_alias *new; struct proxy_alias *new;
if (r!=NULL && cmd->path == NULL ) { char *f = cmd->path;
new = apr_array_push(conf->aliases); char *r = NULL;
new->fake = f; char *word;
new->real = r; apr_table_t *params = apr_table_make(cmd->pool, 5);
} else if (r==NULL && cmd->path != NULL) { const apr_array_header_t *arr;
new = apr_array_push(conf->aliases); const apr_table_entry_t *elts;
new->fake = cmd->path; int i;
new->real = f;
} else {
if ( r== NULL)
return "ProxyPass needs a path when not defined in a location";
else
return "ProxyPass can not have a path when defined in a location";
}
return NULL; while (*arg) {
word = ap_getword_conf(cmd->pool, &arg);
if (!f)
f = word;
else if (!r)
r = word;
else {
char *val = strchr(word, '=');
if (!val) {
if (cmd->path)
return "Invalid ProxyPass parameter. Paramet must be in the form key=value";
else
return "ProxyPass can not have a path when defined in a location";
}
else
*val++ = '\0';
apr_table_setn(params, word, val);
}
};
if (r == NULL)
return "ProxyPass needs a path when not defined in a location";
new = apr_array_push(conf->aliases);
new->fake = f;
new->real = r;
arr = apr_table_elts(params);
elts = (const apr_table_entry_t *)arr->elts;
/* Distinguish the balancer from woker */
if (strncasecmp(r, "balancer:", 9) == 0) {
struct proxy_balancer *balancer = ap_proxy_get_balancer(cmd->pool, conf, r);
if (!balancer) {
}
}
else {
proxy_worker *worker = ap_proxy_get_worker(cmd->pool, conf, r);
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);
}
for (i = 0; i < arr->nelts; i++) {
const char *err = set_worker_param(worker, elts[i].key, elts[i].val);
if (err)
return apr_pstrcat(cmd->temp_pool, "ProxyPass: ", err, NULL);
}
}
return NULL;
} }
static const char * static const char *
@@ -1081,9 +1123,8 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
ap_get_module_config(s->module_config, &proxy_module); ap_get_module_config(s->module_config, &proxy_module);
struct proxy_balancer *balancer; struct proxy_balancer *balancer;
proxy_worker *worker; proxy_worker *worker;
char *path = NULL; char *path = cmd->path;
char *name = NULL; char *name = NULL;
char *args = apr_pstrdup(cmd->pool, arg);
char *word; char *word;
apr_table_t *params = apr_table_make(cmd->pool, 5); apr_table_t *params = apr_table_make(cmd->pool, 5);
const apr_array_header_t *arr; const apr_array_header_t *arr;
@@ -1092,8 +1133,8 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
if (cmd->path) if (cmd->path)
path = apr_pstrdup(cmd->pool, cmd->path); path = apr_pstrdup(cmd->pool, cmd->path);
while (*args) { while (*arg) {
word = ap_getword_conf(cmd->pool, &args); word = ap_getword_conf(cmd->pool, &arg);
if (!path) if (!path)
path = word; path = word;
else if (!name) else if (!name)
@@ -1101,7 +1142,10 @@ static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
else { else {
char *val = strchr(word, '='); char *val = strchr(word, '=');
if (!val) if (!val)
return "Invalid BalancerMember parameter. Paramet must be in the form key=value"; if (cmd->path)
return "BalancerMember can not have a balancer name when defined in a location";
else
return "Invalid BalancerMember parameter. Paramet must be in the form key=value";
else else
*val++ = '\0'; *val++ = '\0';
apr_table_setn(params, word, val); apr_table_setn(params, word, val);
@@ -1296,7 +1340,7 @@ static const command_rec proxy_cmds[] =
"a scheme, partial URL or '*' and a proxy server"), "a scheme, partial URL or '*' and a proxy server"),
AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF, AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF,
"a regex pattern and a proxy server"), "a regex pattern and a proxy server"),
AP_INIT_TAKE12("ProxyPass", add_pass, NULL, RSRC_CONF|ACCESS_CONF, AP_INIT_RAW_ARGS("ProxyPass", add_pass, NULL, RSRC_CONF|ACCESS_CONF,
"a virtual path and a URL"), "a virtual path and a URL"),
AP_INIT_TAKE12("ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF|ACCESS_CONF, AP_INIT_TAKE12("ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF|ACCESS_CONF,
"a virtual path and a URL for reverse proxy behaviour"), "a virtual path and a URL for reverse proxy behaviour"),
@@ -1329,7 +1373,7 @@ static const command_rec proxy_cmds[] =
"This overrides the server timeout"), "This overrides the server timeout"),
AP_INIT_TAKE1("ProxyBadHeader", set_bad_opt, NULL, RSRC_CONF, AP_INIT_TAKE1("ProxyBadHeader", set_bad_opt, NULL, RSRC_CONF,
"How to handle bad header line in response: IsError | Ignore | StartBody"), "How to handle bad header line in response: IsError | Ignore | StartBody"),
AP_INIT_ITERATE("BalancerMember", add_member, NULL, RSRC_CONF|ACCESS_CONF, AP_INIT_RAW_ARGS("BalancerMember", add_member, NULL, RSRC_CONF|ACCESS_CONF,
"A balancer name and scheme with list of params"), "A balancer name and scheme with list of params"),
AP_INIT_TAKE12("BalancerStickySession", set_sticky_session, NULL, RSRC_CONF|ACCESS_CONF, AP_INIT_TAKE12("BalancerStickySession", set_sticky_session, NULL, RSRC_CONF|ACCESS_CONF,
"A balancer and sticky session name"), "A balancer and sticky session name"),