You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2006/08/02 09:59:48 UTC
svn commit: r427928 - /httpd/httpd/trunk/modules/proxy/mod_proxy.c
Author: mturk
Date: Wed Aug 2 00:59:47 2006
New Revision: 427928
URL: http://svn.apache.org/viewvc?rev=427928&view=rev
Log:
Allow optional name=value options within <Proxy
section line. Additional arguments are allowed
only for 'standard' url's, meaning that the wildchar
urls will return error like before.
This allow to specify the worker/balancer parameters
on the definition line, without the need for extra
ProxySet options.
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=427928&r1=427927&r2=427928&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Aug 2 00:59:47 2006
@@ -1698,9 +1698,15 @@
ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
ap_regex_t *r = NULL;
const command_rec *thiscmd = cmd->cmd;
+ char *word, *val;
+ proxy_balancer *balancer = NULL;
+ proxy_worker *worker = NULL;
const char *err = ap_check_cmd_context(cmd,
NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+ proxy_server_conf *sconf =
+ (proxy_server_conf *) ap_get_module_config(cmd->server->module_config, &proxy_module);
+
if (err != NULL) {
return err;
}
@@ -1762,8 +1768,61 @@
ap_add_per_proxy_conf(cmd->server, new_dir_conf);
if (*arg != '\0') {
- return apr_pstrcat(cmd->pool, "Multiple ", thiscmd->name,
- "> arguments not (yet) supported.", NULL);
+ if (thiscmd->cmd_data)
+ return "Multiple <ProxyMatch> arguments not (yet) supported.";
+ if (conf->p_is_fnmatch)
+ return apr_pstrcat(cmd->pool, thiscmd->name,
+ "> arguments are not supported for wildchar url.",
+ NULL);
+ if (!strchr(conf->p, ':'))
+ return apr_pstrcat(cmd->pool, thiscmd->name,
+ "> arguments are not supported for non url.",
+ NULL);
+ if (strncasecmp(conf->p, "balancer:", 9) == 0) {
+ balancer = ap_proxy_get_balancer(cmd->pool, sconf, conf->p);
+ if (!balancer) {
+ err = ap_proxy_add_balancer(&balancer,
+ cmd->pool,
+ sconf, conf->p);
+ if (err)
+ return apr_pstrcat(cmd->temp_pool, thiscmd->name,
+ " ", err, NULL);
+ }
+ }
+ else {
+ worker = ap_proxy_get_worker(cmd->temp_pool, sconf,
+ conf->p);
+ if (!worker) {
+ err = ap_proxy_add_worker(&worker, cmd->pool,
+ sconf, conf->p);
+ if (err)
+ return apr_pstrcat(cmd->temp_pool, thiscmd->name,
+ " ", err, NULL);
+ }
+ }
+ if (worker == NULL && balancer == NULL) {
+ return apr_pstrcat(cmd->pool, thiscmd->name,
+ "> arguments are supported only for workers.",
+ NULL);
+ }
+ while (*arg) {
+ word = ap_getword_conf(cmd->pool, &arg);
+ val = strchr(word, '=');
+ if (!val) {
+ return "Invalid Proxy parameter. Parameter must be "
+ "in the form 'key=value'";
+ }
+ else
+ *val++ = '\0';
+ if (worker)
+ err = set_worker_param(cmd->pool, worker, word, val);
+ else
+ err = set_balancer_param(sconf, cmd->pool, balancer,
+ word, val);
+ if (err)
+ return apr_pstrcat(cmd->temp_pool, thiscmd->name, " ", err, " ",
+ word, "=", val, "; ", conf->p, NULL);
+ }
}
cmd->path = old_path;