if (err)
return apr_pstrcat(cmd->temp_pool, "ProxyPass ", err, NULL);
}
+ new->balancer = balancer;
}
else {
proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, r);
*/
#define DEFAULT_MAX_FORWARDS -1
+typedef struct proxy_balancer proxy_balancer;
+typedef struct proxy_worker proxy_worker;
+typedef struct proxy_conn_pool proxy_conn_pool;
+typedef struct proxy_balancer_method proxy_balancer_method;
+
/* static information about a remote proxy */
struct proxy_remote {
const char *scheme; /* the schemes handled by this proxy, or '*' */
const char *fake;
ap_regex_t *regex;
unsigned int flags;
+ proxy_balancer *balancer; /* only valid for reverse-proxys */
};
struct dirconn_entry {
struct apr_sockaddr_t *addr;
};
-typedef struct proxy_balancer proxy_balancer;
-typedef struct proxy_worker proxy_worker;
-typedef struct proxy_conn_pool proxy_conn_pool;
-typedef struct proxy_balancer_method proxy_balancer_method;
-
typedef struct {
apr_array_header_t *proxies;
apr_array_header_t *sec_proxy;
apr_time_t wupdated; /* timestamp of last change to workers list */
int max_attempts; /* Number of attempts before failing */
int index; /* shm array index */
- int hash;
+ unsigned int hash;
unsigned int sticky_force:1; /* Disable failover for sticky sessions */
unsigned int scolonsep:1; /* true if ';' seps sticky session paths */
unsigned int max_attempts_set:1;
ap_slotmem_provider_t *storage;
int growth; /* number of post-config workers can added */
int max_workers; /* maximum number of allowed workers */
- int hash;
+ unsigned int hash;
apr_time_t wupdated; /* timestamp of last change to workers list */
proxy_balancer_method *lbmethod;
apr_global_mutex_t *gmutex; /* global lock for updating list of workers */
proxy_balancer *balancer;
char *c, *uri = apr_pstrdup(p, url);
int i;
+ unsigned int hash;
c = strchr(uri, ':');
if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') {
if ((c = strchr(c + 3, '/'))) {
*c = '\0';
}
+ hash = ap_proxy_hashfunc(uri, PROXY_HASHFUNC_DEFAULT);
balancer = (proxy_balancer *)conf->balancers->elts;
for (i = 0; i < conf->balancers->nelts; i++) {
- if (strcasecmp(balancer->s->name, uri) == 0) {
+ if (balancer->hash == hash) {
if (!care || !balancer->s->inactive) {
return balancer;
}
}
(*balancer)->s = bshared;
+ (*balancer)->sconf = conf;
return ap_proxy_update_balancer(p, *balancer, alias);
}