forked from lpereira/lwan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestrunner.conf
102 lines (83 loc) · 2.8 KB
/
testrunner.conf
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Timeout in seconds to keep a connection alive.
keep_alive_timeout = 15
# Set to true to not print any debugging messages. (Only effective in
# release builds.)
quiet = false
# Set SO_REUSEPORT=1 in the master socket.
reuse_port = false
# Value of "Expires" header. Default is 1 month and 1 week.
expires = 1M 1w
# Number of I/O threads. Default (0) is number of online CPUs.
threads = 0
# This flag is enabled here so that the automated tests can be executed
# properly, but should be disabled unless absolutely needed (an example
# would be haproxy).
proxy_protocol = true
# Maximum post data size of slightly less than 1MiB. The default is too
# small for testing purposes.
max_post_data_size = 1000000
listener *:8080 {
&hello_world /hello
&quit_lwan /quit-lwan
&test_proxy /proxy
&test_chunked_encoding /chunked
&test_server_sent_event /sse
&gif_beacon /beacon
prefix /favicon.ico {
# Use prefix+handler instead of & for testing purposes
handler = gif_beacon
}
&test_post_will_it_blend /post/blend
&test_post_big /post/big
redirect /elsewhere { to = http://lwan.ws }
response /brew-coffee { code = 418 }
&hello_world /admin {
authorization basic {
realm = Administration Page
password file = htpasswd
}
}
lua /inline {
default type = text/html
cache period = 30s
script = '''function handle_get_root(req)
req:say('Hello')
end'''
}
lua /lua {
default type = text/html
script file = test.lua
cache period = 30s
}
rewrite /pattern {
pattern foo/(%d+)(%a)(%d+) {
redirect to = /hello?name=pre%2middle%3othermiddle%1post
}
pattern bar/(%d+)/test {
rewrite as = /hello?name=rewritten%1
}
pattern lua/redir/(%d+)x(%d+) {
expand_with_lua = true
redirect to = '''
function handle_rewrite(req, captures)
local r = captures[1] * captures[2]
return '/hello?name=redirected' .. r
end
'''
}
pattern lua/rewrite/(%d+)x(%d+) {
expand_with_lua = true
rewrite as = """function handle_rewrite(req, captures)
local r = captures[1] * captures[2]
return '/hello?name=rewritten' .. r
end"""
}
}
serve_files / {
path = ./wwwroot
# When requesting for file.ext, look for a smaller/newer file.ext.gz,
# and serve that instead if `Accept-Encoding: gzip` is in the
# request headers.
serve precompressed files = true
}
}