| 1144 | |
| 1145 | |
| 1146 | PROXY_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 | |
| 1180 | PROXY_DECLARE(char *) ap_proxy_update_balancer(apr_pool_t *p, |
no test coverage detected