httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: [PATCH] Bug 36816: balancer_manager doesn't work if worker name contains port
Date Mon, 10 Oct 2005 15:43:28 GMT
For consideration:

Index: modules/proxy/mod_proxy_balancer.c
===================================================================
--- modules/proxy/mod_proxy_balancer.c    (revision 312628)
+++ modules/proxy/mod_proxy_balancer.c    (working copy)
@@ -477,8 +477,12 @@
                  *val++ = '\0';
                  if ((tok = ap_strchr(val, '&')))
                      *tok++ = '\0';
+                /*
+                 * Special case: workers are allowed path information
+                 */
                  if ((access_status = ap_unescape_url(val)) != OK)
-                    return access_status;
+                    if (strcmp(args, "w") || (access_status !=  
HTTP_NOT_FOUND))
+                        return access_status;
                  apr_table_setn(params, args, val);
                  args = tok;
              }
@@ -490,13 +494,9 @@
          bsel = ap_proxy_get_balancer(r->pool, conf,
              apr_pstrcat(r->pool, "balancer://", name, NULL));
      if ((name = apr_table_get(params, "w"))) {
-        const char *sc = apr_table_get(params, "s");
-        char *asname = NULL;
-        proxy_worker *ws = NULL;
-        if (sc) {
-            asname = apr_pstrcat(r->pool, sc, "://", name, NULL);
-            ws = ap_proxy_get_worker(r->pool, conf, asname);
-        }
+        proxy_worker *ws;
+
+        ws = ap_proxy_get_worker(r->pool, conf, name);
          if (ws) {
              worker = (proxy_worker *)bsel->workers->elts;
              for (n = 0; n < bsel->workers->nelts; n++) {
@@ -634,10 +634,10 @@
                  ap_rvputs(r, "<tr>\n<td>", worker->scheme, "</ 
td><td>", NULL);
                  ap_rvputs(r, "<a href=\"", r->uri, "?b=",
-                          balancer->name + sizeof("balancer://") - 1,
-                          "&s=", worker->scheme, "&w=", worker- 
 >hostname,
+                          balancer->name + sizeof("balancer://") -  
1, "&w=",
+                          ap_escape_uri(r->pool, worker->name),
                            "\">", NULL);
-                ap_rvputs(r, worker->hostname, "</a></td>", NULL);
+                ap_rvputs(r, worker->name, "</a></td>", NULL);
                  ap_rvputs(r, "<td>", worker->s->route, NULL);
                  ap_rvputs(r, "</td><td>", worker->s->redirect, NULL);
                  ap_rprintf(r, "</td><td>%d</td><td>", worker->s-

 >lbfactor);
@@ -678,10 +678,8 @@
                  ap_rputs(" checked", r);
              ap_rputs("></td><tr>\n", r);
              ap_rputs("<tr><td colspan=2><input type=submit value= 
\"Submit\"></td></tr>\n", r);
-            ap_rvputs(r, "</table>\n<input type=hidden name=\"s\" ",  
NULL);
-            ap_rvputs(r, "value=\"", wsel->scheme, "\">\n", NULL);
-            ap_rvputs(r, "<input type=hidden name=\"w\" ", NULL);
-            ap_rvputs(r, "value=\"", wsel->hostname, "\">\n", NULL);
+            ap_rvputs(r, "</table>\n<input type=hidden name=\"w\" ",  
NULL);
+            ap_rvputs(r, "value=\"", ap_escape_uri(r->pool, wsel- 
 >name), "\">\n", NULL);
              ap_rvputs(r, "<input type=hidden name=\"b\" ", NULL);
              ap_rvputs(r, "value=\"", bsel->name + sizeof 
("balancer://") - 1,
                        "\">\n</form>\n", NULL);
Index: modules/proxy/proxy_util.c
===================================================================
--- modules/proxy/proxy_util.c    (revision 312628)
+++ modules/proxy/proxy_util.c    (working copy)
@@ -1218,9 +1218,6 @@
      c = strchr(uri, ':');
      if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0')
         return NULL;
-    /* remove path from uri */
-    if ((c = strchr(c + 3, '/')))
-        *c = '\0';
      worker = (proxy_worker *)conf->workers->elts;
      for (i = 0; i < conf->workers->nelts; i++) {


Mime
View raw message