Skip to content

Commit 560461e

Browse files
author
jiahao
committed
tests: updated the test cases in t/104-req-raw-header.t to reflect the changes in nginx.
multi-line request headers are considered invalid since nginx 1.21.1.
1 parent 913b558 commit 560461e

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

t/020-subrequest.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ r%5B%5D=http%3A%2F%2Fajax.googleapis.com%3A80%2Fajax%2Flibs%2Fjquery%2F1.7.2%2Fj
11611161
GET /main
11621162
--- response_body
11631163
status: 500
1164-
body:
1164+
body:
11651165
11661166
11671167
@@ -1182,7 +1182,7 @@ body:
11821182
GET /main
11831183
--- response_body
11841184
status: 500
1185-
body:
1185+
body:
11861186
11871187
11881188
@@ -1487,7 +1487,7 @@ post subreq: rc=0, status=200
14871487
14881488
--- response_body
14891489
status: 200
1490-
body:
1490+
body:
14911491
truncated: true
14921492
14931493
--- error_log
@@ -1609,7 +1609,7 @@ post subreq: rc=0, status=200
16091609
16101610
--- response_body
16111611
status: 200
1612-
body:
1612+
body:
16131613
truncated: true
16141614
16151615
--- error_log
@@ -2082,7 +2082,7 @@ post subreq: rc=0, status=200
20822082
20832083
--- response_body
20842084
status: 200
2085-
body:
2085+
body:
20862086
truncated: true
20872087
20882088
--- error_log

t/104-req-raw-header.t

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ Foo: bar baz\r
331331
}
332332
--- no_error_log
333333
[error]
334+
--- skip_nginx
335+
3: >= 1.21.1
334336
335337
336338
@@ -362,6 +364,8 @@ Connection: close\r
362364
--- no_error_log
363365
[error]
364366
--- timeout: 5
367+
--- skip_nginx
368+
3: >= 1.21.1
365369
366370
367371
@@ -988,3 +992,28 @@ Connection: close
988992
--- no_error_log
989993
[error]
990994
--- timeout: 5
995+
996+
997+
998+
=== TEST 34: multi-line header is invalid (nginx >= 1.21.1)
999+
--- config
1000+
location /t {
1001+
content_by_lua '
1002+
ngx.print(ngx.req.raw_header())
1003+
';
1004+
}
1005+
--- raw_request eval
1006+
"GET /t HTTP/1.1\r
1007+
Host: localhost\r
1008+
Connection: close\r
1009+
Foo: bar baz\r
1010+
blah\r
1011+
\r
1012+
"
1013+
--- error_code: 400
1014+
--- error_log
1015+
client sent invalid header line: "\x20..." while reading client request headers
1016+
--- no_error_log
1017+
[error]
1018+
--- skip_nginx
1019+
3: < 1.21.1

0 commit comments

Comments
 (0)