MCPcopy Create free account
hub / github.com/apache/httpd / ap_proxy_get_balancer

Function ap_proxy_get_balancer

modules/proxy/proxy_util.c:1146–1177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144
1145
1146PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
1147 proxy_server_conf *conf,
1148 const char *url,
1149 int care)
1150{
1151 proxy_balancer *balancer;
1152 char *c, *uri = apr_pstrdup(p, url);
1153 int i;
1154 proxy_hashes hash;
1155
1156 c = strchr(uri, ':');
1157 if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') {
1158 return NULL;
1159 }
1160 /* remove path from uri */
1161 if ((c = strchr(c + 3, '/'))) {
1162 *c = '\0';
1163 }
1164 ap_str_tolower(uri);
1165 hash.def = ap_proxy_hashfunc(uri, PROXY_HASHFUNC_DEFAULT);
1166 hash.fnv = ap_proxy_hashfunc(uri, PROXY_HASHFUNC_FNV);
1167 balancer = (proxy_balancer *)conf->balancers->elts;
1168 for (i = 0; i < conf->balancers->nelts; i++) {
1169 if (balancer->hash.def == hash.def && balancer->hash.fnv == hash.fnv) {
1170 if (!care || !balancer->s->inactive) {
1171 return balancer;
1172 }
1173 }
1174 balancer++;
1175 }
1176 return NULL;
1177}
1178
1179
1180PROXY_DECLARE(char *) ap_proxy_update_balancer(apr_pool_t *p,

Callers 8

add_passFunction · 0.85
add_memberFunction · 0.85
set_proxy_paramFunction · 0.85
proxysectionFunction · 0.85
balancer_manageFunction · 0.85
balancer_handlerFunction · 0.85

Calls 2

ap_str_tolowerFunction · 0.85
ap_proxy_hashfuncFunction · 0.85

Tested by

no test coverage detected