Mercurial > hg > nginx
comparison src/core/ngx_hash.c @ 7943:2a7155733855
Core: removed unnecessary restriction in hash initialization.
Hash initialization ignores elements with key.data set to NULL.
Nevertheless, the initial hash bucket size check didn't skip them,
resulting in unnecessary restrictions on, for example, variables with
long names and with the NGX_HTTP_VARIABLE_NOHASH flag.
Fix is to update the initial hash bucket size check to skip elements
with key.data set to NULL, similarly to how it is done in other parts
of the code.
author | Alexey Radkov <alexey.radkov@gmail.com> |
---|---|
date | Thu, 19 Aug 2021 20:51:27 +0300 |
parents | eb9c7fb796d5 |
children |
comparison
equal
deleted
inserted
replaced
7942:3f0ab7b6cd71 | 7943:2a7155733855 |
---|---|
272 hinit->name, hinit->name, hinit->bucket_size); | 272 hinit->name, hinit->name, hinit->bucket_size); |
273 return NGX_ERROR; | 273 return NGX_ERROR; |
274 } | 274 } |
275 | 275 |
276 for (n = 0; n < nelts; n++) { | 276 for (n = 0; n < nelts; n++) { |
277 if (names[n].key.data == NULL) { | |
278 continue; | |
279 } | |
280 | |
277 if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *)) | 281 if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *)) |
278 { | 282 { |
279 ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, | 283 ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0, |
280 "could not build %s, you should " | 284 "could not build %s, you should " |
281 "increase %s_bucket_size: %i", | 285 "increase %s_bucket_size: %i", |