Mercurial > hg > nginx-vendor-current
comparison src/core/ngx_hash.c @ 570:8246d8a2c2be NGINX_0_8_37
nginx 0.8.37
*) Feature: the ngx_http_split_clients_module.
*) Feature: the "map" directive supports keys more than 255 characters.
*) Bugfix: nginx ignored the "private" and "no-store" values in the
"Cache-Control" backend response header line.
*) Bugfix: a "stub" parameter of an "include" SSI directive was not
used, if empty response has 200 status code.
*) Bugfix: if a proxied or FastCGI request was internally redirected to
another proxied or FastCGI location, then a segmentation fault might
occur in a worker process; the bug had appeared in 0.8.33.
Thanks to Yichun Zhang.
*) Bugfix: IMAP connections may hang until they timed out while talking
to Zimbra server.
Thanks to Alan Batie.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 17 May 2010 00:00:00 +0400 |
parents | 0161f3197817 |
children | 5a4401b9551b |
comparison
equal
deleted
inserted
replaced
569:19b134bf21c0 | 570:8246d8a2c2be |
---|---|
243 return NULL; | 243 return NULL; |
244 } | 244 } |
245 | 245 |
246 | 246 |
247 #define NGX_HASH_ELT_SIZE(name) \ | 247 #define NGX_HASH_ELT_SIZE(name) \ |
248 (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *))) | 248 (sizeof(void *) + ngx_align((name)->key.len + 2, sizeof(void *))) |
249 | 249 |
250 ngx_int_t | 250 ngx_int_t |
251 ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) | 251 ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts) |
252 { | 252 { |
253 u_char *elts; | 253 u_char *elts; |
255 u_short *test; | 255 u_short *test; |
256 ngx_uint_t i, n, key, size, start, bucket_size; | 256 ngx_uint_t i, n, key, size, start, bucket_size; |
257 ngx_hash_elt_t *elt, **buckets; | 257 ngx_hash_elt_t *elt, **buckets; |
258 | 258 |
259 for (n = 0; n < nelts; n++) { | 259 for (n = 0; n < nelts; n++) { |
260 if (names[n].key.len >= 255) { | |
261 ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, | |
262 "the \"%V\" value to hash is to long: %uz bytes, " | |
263 "the maximum length can be 255 bytes only", | |
264 &names[n].key, names[n].key.len); | |
265 return NGX_ERROR; | |
266 } | |
267 | |
268 if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *)) | 260 if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *)) |
269 { | 261 { |
270 ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, | 262 ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, |
271 "could not build the %s, you should " | 263 "could not build the %s, you should " |
272 "increase %s_bucket_size: %i", | 264 "increase %s_bucket_size: %i", |
404 | 396 |
405 key = names[n].key_hash % size; | 397 key = names[n].key_hash % size; |
406 elt = (ngx_hash_elt_t *) ((u_char *) buckets[key] + test[key]); | 398 elt = (ngx_hash_elt_t *) ((u_char *) buckets[key] + test[key]); |
407 | 399 |
408 elt->value = names[n].value; | 400 elt->value = names[n].value; |
409 elt->len = (u_char) names[n].key.len; | 401 elt->len = (u_short) names[n].key.len; |
410 | 402 |
411 ngx_strlow(elt->name, names[n].key.data, names[n].key.len); | 403 ngx_strlow(elt->name, names[n].key.data, names[n].key.len); |
412 | 404 |
413 test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); | 405 test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n])); |
414 } | 406 } |