Skip to content

Commit 682f8cc

Browse files
authored
fix: should not limit the header number (#6379)
1 parent 17338b9 commit 682f8cc

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

apisix/core/request.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ local function _headers(ctx)
4343
end
4444
local headers = ctx.headers
4545
if not headers then
46-
headers = get_headers()
46+
headers = get_headers(0)
4747
ctx.headers = headers
4848
end
4949

apisix/plugins/request-validation.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ function _M.check_schema(conf)
6666
end
6767

6868

69-
function _M.rewrite(conf)
70-
local headers = ngx.req.get_headers()
69+
function _M.rewrite(conf, ctx)
70+
local headers = core.request.headers(ctx)
7171

7272
if conf.header_schema then
7373
local ok, err = core.schema.check(conf.header_schema, headers)

t/core/request.t

+21
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,24 @@ the post form is too large: request body in temp file not supported
422422
POST /t
423423
--- response_body
424424
POST
425+
426+
427+
428+
=== TEST 14: get header
429+
--- config
430+
location /t {
431+
content_by_lua_block {
432+
local core = require("apisix.core")
433+
ngx.say(core.request.header(ngx.ctx, "X-101"))
434+
}
435+
}
436+
--- more_headers eval
437+
my $i = 1;
438+
my $s;
439+
while ($i <= 101) {
440+
$s .= "X-$i:$i\n";
441+
$i++;
442+
}
443+
$s
444+
--- response_body
445+
101

0 commit comments

Comments
 (0)