]> granicus.if.org Git - apache/commitdiff
Merge r1207467 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 28 Nov 2011 17:10:39 +0000 (17:10 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 28 Nov 2011 17:10:39 +0000 (17:10 +0000)
"Final" (I hope) proxy struct/API changes in order to support
dynamic balancer allocation AND dynamic vhost-balancers
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1207468 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.h
modules/proxy/proxy_util.c

index 7ca5071b405d595c217de3cea250e0b6c87eacf7..234bfed0885360ff9bbb5a892832d28941382919 100644 (file)
@@ -298,6 +298,7 @@ PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
 /* Some max char string sizes, for shm fields */
 #define PROXY_WORKER_MAX_SCHEME_SIZE    16
 #define PROXY_WORKER_MAX_ROUTE_SIZE     64
+#define PROXY_BALANCER_MAX_ROUTE_SIZE PROXY_WORKER_MAX_ROUTE_SIZE
 #define PROXY_WORKER_MAX_NAME_SIZE      96
 #define PROXY_BALANCER_MAX_NAME_SIZE PROXY_WORKER_MAX_NAME_SIZE
 #define PROXY_WORKER_MAX_HOSTNAME_SIZE  64
@@ -401,7 +402,8 @@ typedef struct {
     char      nonce[APR_UUID_FORMATTED_LENGTH + 1];
     char      name[PROXY_BALANCER_MAX_NAME_SIZE];
     char      sname[PROXY_BALANCER_MAX_NAME_SIZE];
-    char      alias[PROXY_BALANCER_MAX_NAME_SIZE];
+    char      vpath[PROXY_BALANCER_MAX_ROUTE_SIZE];
+    char      vhost[PROXY_BALANCER_MAX_HOSTNAME_SIZE];
     apr_interval_time_t timeout;  /* Timeout for waiting on free connection */
     apr_time_t      wupdated;     /* timestamp of last change to workers list */
     int             max_attempts;     /* Number of attempts before failing */
index 86ce41b08f91e8b48df98eb28c947947fe3af668..a89a8db233627a486156fa3b9056632b7f31d92a 100644 (file)
@@ -1329,6 +1329,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
     proxy_balancer_shared *bshared;
     char *c, *q, *uri = apr_pstrdup(p, url);
     const char *sname;
+    apr_uri_t puri;
 
     /* We should never get here without a valid BALANCER_PREFIX... */
 
@@ -1343,6 +1344,8 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
     *balancer = apr_array_push(conf->balancers);
     memset(*balancer, 0, sizeof(proxy_balancer));
 
+    apr_uri_parse(p, alias, &puri);
+
     /*
      * NOTE: The default method is byrequests, which we assume
      * exists!
@@ -1375,8 +1378,8 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
     if (PROXY_STRNCPY(bshared->sname, sname) != APR_SUCCESS) {
         return apr_psprintf(p, "balancer safe-name (%s) too long", sname);
     }
-    if (PROXY_STRNCPY(bshared->alias, alias) != APR_SUCCESS) {
-        return apr_psprintf(p, "balancer front-end url (%s) too long", alias);
+    if (PROXY_STRNCPY(bshared->vpath, puri.path) != APR_SUCCESS) {
+        return apr_psprintf(p, "balancer front-end virtual-path (%s) too long", puri.path);
     }
     bshared->hash = ap_proxy_hashfunc(bshared->name, PROXY_HASHFUNC_DEFAULT);    
     (*balancer)->hash = bshared->hash;