httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r571624 - in /httpd/httpd/branches/2.2.x: STATUS modules/proxy/mod_proxy.c
Date Fri, 31 Aug 2007 22:28:31 GMT
Author: jim
Date: Fri Aug 31 15:28:30 2007
New Revision: 571624

URL: http://svn.apache.org/viewvc?rev=571624&view=rev
Log:
Merge r427928, r428291 from trunk:

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.

* modules/proxy/mod_proxy.c (proxysection): Fix another strchr() warning.

Reviewed by: root

Modified:
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=571624&r1=571623&r2=571624&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Fri Aug 31 15:28:30 2007
@@ -79,19 +79,6 @@
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * mod_proxy: 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.
-      Trunk version of patch:
-         http://svn.apache.org/viewcvs.cgi?rev=427928&view=rev
-         http://svn.apache.org/viewcvs.cgi?rev=428291&view=rev
-      Backport version for 2.2.x of patch:
-         Trunk version of patch works
-      +1: rpluem, jim, niq
-
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
 

Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c?rev=571624&r1=571623&r2=571624&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c Fri Aug 31 15:28:30 2007
@@ -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 (!ap_strchr_c(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;



Mime
View raw message