Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: precalculate hash for "Cookie".

Maxim Dounin
February 15, 2018 01:18PM
details: http://hg.nginx.org/nginx/rev/3dfe9444324b
branches:
changeset: 7209:3dfe9444324b
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Feb 15 19:06:22 2018 +0300
description:
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.

diffstat:

src/http/v2/ngx_http_v2.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
--- 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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: precalculate hash for "Cookie".

Maxim Dounin 809 February 15, 2018 01:18PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready