Skip to content

Commit 790e57d

Browse files
committed
optimize: reading ngx.header.HEADER: reduce allocations in the nginx request memory pool.
1 parent c37e6a6 commit 790e57d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ngx_http_lua_headers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ ngx_http_lua_ngx_header_get(lua_State *L)
532532

533533
dd("key: %.*s, len %d", (int) len, p, (int) len);
534534

535-
key.data = ngx_palloc(r->pool, len + 1);
535+
key.data = (u_char*) lua_newuserdata(L, len + 1);
536536
if (key.data == NULL) {
537537
return luaL_error(L, "no memory");
538538
}

0 commit comments

Comments
 (0)