Mercurial > hg > nginx-vendor-0-7
diff src/core/ngx_hash.c @ 392:34fb3a573548 NGINX_0_7_8
nginx 0.7.8
*) Feature: the ngx_http_xslt_module.
*) Feature: the "$arg_..." variables.
*) Feature: Solaris directio support.
Thanks to Ivan Debnar.
*) Bugfix: now if FastCGI server sends a "Location" header line without
status line, then nginx uses 302 status code.
Thanks to Maxim Dounin.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 04 Aug 2008 00:00:00 +0400 |
parents | 984bb0b1399b |
children | 05981f639d21 |
line wrap: on
line diff
--- a/src/core/ngx_hash.c +++ b/src/core/ngx_hash.c @@ -390,9 +390,7 @@ found: elt->value = names[n].value; elt->len = (u_char) names[n].key.len; - for (i = 0; i < names[n].key.len; i++) { - elt->name[i] = ngx_tolower(names[n].key.data[i]); - } + ngx_strlow(elt->name, names[n].key.data, names[n].key.len); test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); } @@ -622,6 +620,24 @@ ngx_hash_key_lc(u_char *data, size_t len } +ngx_uint_t +ngx_hash_strlow(u_char *dst, u_char *src, size_t n) +{ + ngx_uint_t key; + + key = 0; + + while (n--) { + *dst = ngx_tolower(*src); + key = ngx_hash(key, *dst); + dst++; + src++; + } + + return key; +} + + ngx_int_t ngx_hash_keys_array_init(ngx_hash_keys_arrays_t *ha, ngx_uint_t type) { @@ -796,12 +812,7 @@ wildcard: /* wildcard hash */ - k = 0; - - for (i = skip; i < last; i++) { - key->data[i] = ngx_tolower(key->data[i]); - k = ngx_hash(k, key->data[i]); - } + k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip); k %= ha->hsize;