Skip to content

Commit d0e56ca

Browse files
spacewanderzhuizhuhaomeng
authored andcommitted
optimize: don't calculate hash when clearing the header.
1 parent a276476 commit d0e56ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ngx_http_lua_headers_out.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,13 @@ ngx_http_lua_set_output_header(ngx_http_request_t *r, ngx_http_lua_ctx_t *ctx,
499499
return NGX_ERROR;
500500
}
501501

502-
hv.hash = ngx_hash_key_lc(key.data, key.len);
502+
if (value.len > 0) {
503+
hv.hash = ngx_hash_key_lc(key.data, key.len);
504+
505+
} else {
506+
hv.hash = 0;
507+
}
508+
503509
hv.key = key;
504510

505511
hv.offset = 0;

0 commit comments

Comments
 (0)