Skip to content

Commit 2fce8ca

Browse files
spacewanderzhuizhuhaomeng
authored andcommitted
optimize: don't calculate hash when clearing the request header.
1 parent 85388f4 commit 2fce8ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ngx_http_lua_headers_in.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,13 @@ ngx_http_lua_set_input_header(ngx_http_request_t *r, ngx_str_t key,
669669
return NGX_ERROR;
670670
}
671671

672-
hv.hash = ngx_hash_key_lc(key.data, key.len);
672+
if (value.len > 0) {
673+
hv.hash = ngx_hash_key_lc(key.data, key.len);
674+
675+
} else {
676+
hv.hash = 0;
677+
}
678+
673679
hv.key = key;
674680

675681
hv.offset = 0;

0 commit comments

Comments
 (0)