I do some development for this in todo list: use ngx_hash_t to optimize the built-in header look-up process for ngx.req.set_header, ngx.header.HEADER, and etc.
when I run the unittest, I got this error which I think should be OK.
# prove -I/opt/openresty/test-nginx/lib t/111-req-header-ua.t
t/111-req-header-ua.t .. 1/144
# Failed test 'TEST 1: clear Opera user-agent - response_body - response is expected (repeated req 0, req 0)'
# at /opt/openresty/test-nginx/lib/Test/Nginx/Socket.pm line 1277.
# got: 'User-Agent:
# '
# expected: 'User-Agent:
# '
# Failed test 'TEST 1: clear Opera user-agent - response_body - response is expected (repeated req 1, req 0)'
# at /opt/openresty/test-nginx/lib/Test/Nginx/Socket.pm line 1277.
# got: 'User-Agent:
# '
# expected: 'User-Agent:
# '
t/111-req-header-ua.t .. 20/144
.....
.....
t/111-req-header-ua.t .. 136/144 # Looks like you failed 18 tests of 144.
t/111-req-header-ua.t .. Dubious, test returned 18 (wstat 4608, 0x1200)
Failed 18/144 subtests
(less 36 skipped subtests: 90 okay)