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: should not limit the header number #6379

Merged
merged 1 commit into from
Feb 19, 2022
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
2 changes: 1 addition & 1 deletion apisix/core/request.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local function _headers(ctx)
end
local headers = ctx.headers
if not headers then
headers = get_headers()
headers = get_headers(0)
ctx.headers = headers
end

Expand Down
4 changes: 2 additions & 2 deletions apisix/plugins/request-validation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ function _M.check_schema(conf)
end


function _M.rewrite(conf)
local headers = ngx.req.get_headers()
function _M.rewrite(conf, ctx)
local headers = core.request.headers(ctx)

if conf.header_schema then
local ok, err = core.schema.check(conf.header_schema, headers)
Expand Down
21 changes: 21 additions & 0 deletions t/core/request.t
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,24 @@ the post form is too large: request body in temp file not supported
POST /t
--- response_body
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