Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(request.headers): no longer returns all http headers, but limited to the default 100. #11140

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apisix/core/request.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ local function _headers(ctx)
end

if not is_apisix_or then
return get_headers(0)
return get_headers()
end

if a6_request.is_request_header_set() then
a6_request.clear_request_header()
ctx.headers = get_headers(0)
ctx.headers = get_headers()
end

local headers = ctx.headers
if not headers then
headers = get_headers(0)
headers = get_headers()
ctx.headers = headers
end

Expand Down
25 changes: 2 additions & 23 deletions t/core/request.t
Original file line number Diff line number Diff line change
Expand Up @@ -421,28 +421,7 @@ POST



=== TEST 14: get header
--- config
location /t {
content_by_lua_block {
local core = require("apisix.core")
ngx.say(core.request.header(ngx.ctx, "X-101"))
}
}
--- more_headers eval
my $i = 1;
my $s;
while ($i <= 101) {
$s .= "X-$i:$i\n";
$i++;
}
$s
--- response_body
101



=== TEST 15: add header
=== TEST 14: add header
--- config
location /t {
content_by_lua_block {
Expand All @@ -468,7 +447,7 @@ test



=== TEST 16: call add_header with deprecated way
=== TEST 15: call add_header with deprecated way
--- config
location /t {
content_by_lua_block {
Expand Down
Loading