Opened 6 years ago

Last modified 6 years ago

#1500 accepted enhancement

ngx_hash_t can have only lower case key

Reported by: lazylad91@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: Cc: makkarparteek@…
uname -a: 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
nginx -V: 1.13


ngx_hash_init convert all the keys in lower case, so when use ngx_hash_find it returns null.
Below is the code line in ngx_hash.c.

key = ngx_hash(key, ngx_tolower(data[i]));

I think, you can make it generic which supports case sensitive keys.

Change History (2)

comment:1 by vl, 6 years ago

Status: newaccepted
Type: defectenhancement

yes, you are right, currently only lowercase keys are possible.
there is no great need in case sensitive keys though at the moment.

comment:2 by lazylad91@…, 6 years ago

I think you should mention in the documentation that ngx_hash_t doesnt support case sensitive keys. And in my case it was needed and I just use another function to copy string instead of ngx_tolower. I hope it doesnt break the hash?

Note: See TracTickets for help on using tickets.