summaryrefslogtreecommitdiffstats
path: root/modules/proxy/proxy_util.c
diff options
context:
space:
mode:
authorJim Jagielski <jim@apache.org>2011-11-29 22:14:08 +0100
committerJim Jagielski <jim@apache.org>2011-11-29 22:14:08 +0100
commite13a72390470b8b3e9990ffa9270a292e0a43c74 (patch)
treee9e4f762977587ffe19cc382c5240da76fa58f5b /modules/proxy/proxy_util.c
parentwhitespace (diff)
downloadapache2-e13a72390470b8b3e9990ffa9270a292e0a43c74.tar.xz
apache2-e13a72390470b8b3e9990ffa9270a292e0a43c74.zip
Some optimization... we have a hash, use it. Quicker than all
these string comparisons. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1208068 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--modules/proxy/proxy_util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index df3d6d9609..d8c45e5210 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -1298,6 +1298,7 @@ PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
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') {
@@ -1307,9 +1308,10 @@ PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
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;
}
@@ -1410,6 +1412,7 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
}
(*balancer)->s = bshared;
+ (*balancer)->sconf = conf;
return ap_proxy_update_balancer(p, *balancer, alias);
}