-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy path092-eof.t
82 lines (71 loc) · 1.51 KB
/
092-eof.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# vim:set ft= ts=4 sw=4 et fdm=marker:
use Test::Nginx::Socket::Lua;
#worker_connections(1014);
#master_on();
#workers(2);
#log_level('warn');
repeat_each(2);
#repeat_each(1);
plan tests => repeat_each() * (blocks() * 6);
master_on();
workers(2);
no_root_location();
#no_diff();
#no_long_string();
run_tests();
__DATA__
=== TEST 1: 404 parallel subrequests after ngx.eof()
--- config
location = /lua {
content_by_lua '
ngx.say(1)
ngx.eof()
local res1, res2 = ngx.location.capture_multi{
{ "/bad1" },
{ "/bad2" }
}
ngx.log(ngx.WARN, "res1: ", res1.status)
ngx.log(ngx.WARN, "res2: ", res2.status)
';
}
--- request
GET /lua
--- response_body
1
--- no_error_log
[alert]
--- error_log
res1: 404
res2: 404
No such file or directory
=== TEST 2: parallel normal subrequests after ngx.eof()
--- config
location = /t {
content_by_lua '
ngx.say(1)
ngx.eof()
local r1, r2 = ngx.location.capture_multi{
{ "/proxy/tom" },
{ "/proxy/jim" }
}
ngx.log(ngx.WARN, r1.body)
ngx.log(ngx.WARN, r2.body)
';
}
location ~ '^/proxy/(\w+)' {
proxy_pass http://127.0.0.1:$server_port/hello?a=$1;
}
location = /hello {
echo_sleep 0.5;
echo -n "hello, $arg_a";
}
--- request
GET /t
--- response_body
1
--- no_error_log
[alert]
[error]
--- error_log
hello, tom
hello, jim