comparison src/http/v2/ngx_http_v2.c @ 7209:3dfe9444324b

HTTP/2: precalculate hash for "Cookie". There is no need to calculate hashes of static strings at runtime. The ngx_hash() macro can be used to do it during compilation instead, similarly to how it is done in ngx_http_proxy_module.c for "Server" and "Date" headers.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 15 Feb 2018 19:06:22 +0300
parents affeb6ef732c
children aa60f5799a4c
comparison
equal deleted inserted replaced
7208:affeb6ef732c 7209:3dfe9444324b
3696 if (h == NULL) { 3696 if (h == NULL) {
3697 ngx_http_v2_close_stream(r->stream, NGX_HTTP_INTERNAL_SERVER_ERROR); 3697 ngx_http_v2_close_stream(r->stream, NGX_HTTP_INTERNAL_SERVER_ERROR);
3698 return NGX_ERROR; 3698 return NGX_ERROR;
3699 } 3699 }
3700 3700
3701 h->hash = ngx_hash_key(cookie.data, cookie.len); 3701 h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash(
3702 ngx_hash('c', 'o'), 'o'), 'k'), 'i'), 'e');
3702 3703
3703 h->key.len = cookie.len; 3704 h->key.len = cookie.len;
3704 h->key.data = cookie.data; 3705 h->key.data = cookie.data;
3705 3706
3706 h->value.len = len; 3707 h->value.len = len;