Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 31550 invoked from network); 11 Aug 2004 21:31:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Aug 2004 21:31:01 -0000 Received: (qmail 63984 invoked by uid 500); 11 Aug 2004 21:30:59 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 63951 invoked by uid 500); 11 Aug 2004 21:30:59 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 63938 invoked by uid 500); 11 Aug 2004 21:30:59 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Received: (qmail 63935 invoked by uid 99); 11 Aug 2004 21:30:59 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Wed, 11 Aug 2004 14:30:58 -0700 Received: (qmail 31520 invoked by uid 1134); 11 Aug 2004 21:30:58 -0000 Date: 11 Aug 2004 21:30:58 -0000 Message-ID: <20040811213058.31519.qmail@minotaur.apache.org> From: wrowe@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/proxy mod_proxy.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N wrowe 2004/08/11 14:30:58 Modified: modules/proxy mod_proxy.c Log: Use RAW_ARGS instead ITERATE. Add options for connection pool when using ProxyPass Submitted by: mturk Revision Changes Path 1.109 +67 -23 httpd-2.0/modules/proxy/mod_proxy.c Index: mod_proxy.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.c,v retrieving revision 1.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- mod_proxy.c 11 Aug 2004 21:29:57 -0000 1.108 +++ mod_proxy.c 11 Aug 2004 21:30:57 -0000 1.109 @@ -739,28 +739,70 @@ } 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; proxy_server_conf *conf = (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module); struct proxy_alias *new; - if (r!=NULL && cmd->path == NULL ) { - new = apr_array_push(conf->aliases); - new->fake = f; - new->real = r; - } else if (r==NULL && cmd->path != NULL) { - new = apr_array_push(conf->aliases); - new->fake = cmd->path; - 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"; - } + char *f = cmd->path; + char *r = NULL; + char *word; + apr_table_t *params = apr_table_make(cmd->pool, 5); + const apr_array_header_t *arr; + const apr_table_entry_t *elts; + int i; + + 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"; - return NULL; + 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 * @@ -1081,9 +1123,8 @@ ap_get_module_config(s->module_config, &proxy_module); struct proxy_balancer *balancer; proxy_worker *worker; - char *path = NULL; + char *path = cmd->path; char *name = NULL; - char *args = apr_pstrdup(cmd->pool, arg); char *word; apr_table_t *params = apr_table_make(cmd->pool, 5); const apr_array_header_t *arr; @@ -1092,8 +1133,8 @@ if (cmd->path) path = apr_pstrdup(cmd->pool, cmd->path); - while (*args) { - word = ap_getword_conf(cmd->pool, &args); + while (*arg) { + word = ap_getword_conf(cmd->pool, &arg); if (!path) path = word; else if (!name) @@ -1101,7 +1142,10 @@ else { char *val = strchr(word, '='); 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 *val++ = '\0'; apr_table_setn(params, word, val); @@ -1296,7 +1340,7 @@ "a scheme, partial URL or '*' and a proxy server"), AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF, "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"), AP_INIT_TAKE12("ProxyPassReverse", add_pass_reverse, NULL, RSRC_CONF|ACCESS_CONF, "a virtual path and a URL for reverse proxy behaviour"), @@ -1329,7 +1373,7 @@ "This overrides the server timeout"), AP_INIT_TAKE1("ProxyBadHeader", set_bad_opt, NULL, RSRC_CONF, "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"), AP_INIT_TAKE12("BalancerStickySession", set_sticky_session, NULL, RSRC_CONF|ACCESS_CONF, "A balancer and sticky session name"),