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

Function ap_proxy_hashfunc

modules/proxy/proxy_util.c:4295–4320  ·  view source on GitHub ↗

* Provide a string hashing function for the proxy. * We offer 2 methods: one is the APR model but we * also provide our own, based on either FNV or SDBM. * The reason is in case we want to use both to ensure no * collisions. */

Source from the content-addressed store, hash-verified

4293 * collisions.
4294 */
4295PROXY_DECLARE(unsigned int)
4296ap_proxy_hashfunc(const char *str, proxy_hash_t method)
4297{
4298 if (method == PROXY_HASHFUNC_APR) {
4299 apr_ssize_t slen = strlen(str);
4300 return apr_hashfunc_default(str, &slen);
4301 }
4302 else if (method == PROXY_HASHFUNC_FNV) {
4303 /* FNV model */
4304 unsigned int hash;
4305 const unsigned int fnv_prime = 0x811C9DC5;
4306 for (hash = 0; *str; str++) {
4307 hash *= fnv_prime;
4308 hash ^= (*str);
4309 }
4310 return hash;
4311 }
4312 else { /* method == PROXY_HASHFUNC_DEFAULT */
4313 /* SDBM model */
4314 unsigned int hash;
4315 for (hash = 0; *str; str++) {
4316 hash = (*str) + (hash << 6) + (hash << 16) - hash;
4317 }
4318 return hash;
4319 }
4320}
4321
4322PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(char c, int set, proxy_worker *w)
4323{

Callers 6

child_initFunction · 0.85
balancer_post_configFunction · 0.85
hc_get_hcworkerFunction · 0.85
ap_proxy_get_balancerFunction · 0.85
ap_proxy_define_balancerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected