Skip to content

Commit e5d47c4

Browse files
committed
bugfix: we always printed the "lua hit request header limit" debug log message even when the limit is not hit at all. this regression had appeared in commit d8a2664.
1 parent 789e36b commit e5d47c4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/ngx_http_lua_headers.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ ngx_http_lua_ngx_req_get_headers(lua_State *L)
331331

332332
if (max > 0 && count > max) {
333333
count = max;
334+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
335+
"lua exceeding request header limit %d", max);
334336
}
335337

336338
lua_createtable(L, 0, count);
@@ -378,9 +380,6 @@ ngx_http_lua_ngx_req_get_headers(lua_State *L)
378380
&header[i].key, &header[i].value);
379381

380382
if (--count == 0) {
381-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
382-
"lua hit request header limit %d", max);
383-
384383
return 1;
385384
}
386385
}

t/028-req-header.t

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use t::TestNginxLua;
99

1010
repeat_each(2);
1111

12-
plan tests => repeat_each() * (2 * blocks() + 18);
12+
plan tests => repeat_each() * (2 * blocks() + 19);
1313

1414
#no_diff();
1515
#no_long_string();
@@ -34,6 +34,9 @@ Bar: baz
3434
--- response_body
3535
Foo: bar
3636
Bar: baz
37+
--- log_level: debug
38+
--- no_error_log
39+
lua exceeding request header limit
3740
3841
3942
@@ -427,7 +430,7 @@ for my $k (@k) {
427430
CORE::join("", @k);
428431
--- timeout: 4
429432
--- error_log
430-
lua hit request header limit 100
433+
lua exceeding request header limit 100
431434
432435
433436
@@ -475,7 +478,7 @@ for my $k (@k) {
475478
CORE::join("", @k);
476479
--- timeout: 4
477480
--- error_log
478-
lua hit request header limit 102
481+
lua exceeding request header limit 102
479482
480483
481484

0 commit comments

Comments
 (0)