changeset 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 fb1212c7eca4
files src/http/v2/ngx_http_v2.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -3698,7 +3698,8 @@ ngx_http_v2_construct_cookie_header(ngx_
         return NGX_ERROR;
     }
 
-    h->hash = ngx_hash_key(cookie.data, cookie.len);
+    h->hash = ngx_hash(ngx_hash(ngx_hash(ngx_hash(
+                                    ngx_hash('c', 'o'), 'o'), 'k'), 'i'), 'e');
 
     h->key.len = cookie.len;
     h->key.data = cookie.data;