Skip to content

Commit

Permalink
fix: should not limit the header number (#6379)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander committed Feb 19, 2022
1 parent 17338b9 commit 682f8cc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
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

0 comments on commit 682f8cc

Please sign in to comment.