blob: 3b6dbdf0b3e1c62e1dddba9483ab0c6aac62af2a [file] [log] [blame]
Willy Tarreauc22b57d2008-08-17 19:30:03 +02001# This is a test configuration.
2# It exercises some critical state machine transitions. Start it in debug
3# mode with syslogd listening to UDP socket, facility local0.
4
5########### test#0001: process_cli(), read or write error
6# setup :
7# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat /dev/zero) | nc -lp4000
8# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001 >/dev/null
9# action : kill client during transfer (Ctrl-C)
10# result : both sides must close, and logs must report "CD" flags with
11# valid timers and counters. (note: high CPU usage expected)
12# example: 0/0/3/0/5293 200 76420076 - - CD--
13
14########### test#0002: process_cli(), read closed on client side first
15# setup :
16# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat /dev/zero) | nc -lp4000
17# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
18# action : end client output during transfer (Ctrl-D)
19# result : client exits, log is emitted immediately, server must be terminated
20# by hand. Logs indicate "----" with correct timers.
21# example: 0/0/3/0/5293 200 76420076 - - ----
22# note : test#0003 is triggered immediately after this test
23
24########### test3: process_cli(), read closed on server side first
25# setup :
26# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
27# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
28# action : end server output during transfer (Ctrl-D)
29# result : server exits, log is emitted immediately, client must be terminated
30# by hand. Logs indicate "----" with correct timers.
31# example: 0/0/3/0/5293 200 76420076 - - ----
32# note : test#0002 is triggered immediately after this test
33
34########### test4: process_cli(), read timeout on client side
35# setup :
36# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
37# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
38# action : wait at least 7 seconds and check the logs
39# result : log is emitted immediately, client and server must be terminated
40# by hand. Logs indicate "cD--" with correct timers.
41# example: 0/0/1/0/7006 200 19 - - cD--
42# note : test#0003 is triggered immediately after this test
43
44########### test5: ability to restart read after a request buffer full
45# setup :
46# server = (printf "HTTP/1.0 200 OK\r\n\r\n"; cat) | nc -lp4000
47# client = (printf "GET / HTTP/1.0\r\n\r\n";cat 8k.txt;cat) | nc 127.1 8001
48# action : enter data on the client, press enter, then Ctrl-D
49# result : data transferred to the server, client exits, log is emitted
50# immediately, server must be terminated by hand. Logs indicate
51# "----" with correct timers.
52# example: 0/0/0/0/3772 200 19 - - ----
53
54########### test6: ability to restart read after a request buffer partially full
55# setup :
56# server = (printf "HTTP/1.0 200 OK\r\n\r\n"; cat) | nc -lp4000
57# client = (printf "GET / HTTP/1.0\r\n\r\n";cat 7k.txt;cat) | nc 127.1 8001
58# action : enter data on the client, press enter, then Ctrl-D
59# result : data transferred to the server, client exits, log is emitted
60# immediately, server must be terminated by hand. Logs indicate
61# "----" with correct timers.
62# example: 0/0/0/0/3772 200 19 - - ----
63
64########### test7: ability to restart read after a response buffer full
65# setup :
66# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat 8k.txt; cat) | nc -lp4000
67# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
68# action : enter data on the server, press enter, then Ctrl-D
69# result : data transferred to the client, server exits, log is emitted
70# immediately, client must be terminated by hand. Logs indicate
71# "----" with correct timers.
72# example: 0/0/0/0/3087 200 8242 - - ----
73
74########### test8: ability to restart read after a response buffer partially full
75# setup :
76# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat 7k.txt; cat) | nc -lp4000
77# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
78# action : enter data on the server, press enter, then Ctrl-D
79# result : data transferred to the client, server exits, log is emitted
80# immediately, client must be terminated by hand. Logs indicate
81# "----" with correct timers.
82# example: 0/0/0/0/5412 200 7213 - - ----
83
84########### test9: process_cli(), read timeout on empty request
85# setup :
86# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
87# client = nc 127.1 8001
88# action : wait at least 5 seconds and check the logs
89# result : client returns 408, log is emitted immediately, server must be
90# terminated by hand. Logs indicate "cR--" with correct timers
91# and "<BADREQ>"
92# example: -1/-1/-1/-1/5000 408 212 - - cR--
93
94########### test10: process_cli(), read timeout on client headers
95# setup :
96# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
97# client = (printf "GET / HTTP/1.0\r\nTest: test\r\n";cat) | nc 127.1 8001
98# action : wait at least 5 seconds and check the logs
99# result : client returns 408, log is emitted immediately, both must be
100# terminated by hand. Logs indicate "cR--" with correct timers
101# and "<BADREQ>"
102# example: -1/-1/-1/-1/5004 408 212 - - cR--
103
104########### test11: process_cli(), read abort on empty request
105# setup :
106# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
107# client = echo -n | nc 127.1 8001
108# action : just check the logs after the client immediately returns
109# result : client returns 400, log is emitted immediately, server must be
110# terminated by hand. Logs indicate "CR--" with correct timers
111# and "<BADREQ>"
112# example: -1/-1/-1/-1/0 400 187 - - CR--
113
114########### test12: process_cli(), read abort on client headers
115# setup :
116# server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
117# client = (printf "GET / HTTP/1.0\r\nTest: test\r\n") | nc 127.1 8001
118# action : just check the logs after the client immediately returns
119# result : client returns 400, log is emitted immediately, server must be
120# terminated by hand. Logs indicate "CR--" with correct timers
121# and "<BADREQ>"
122# example: -1/-1/-1/-1/0 400 187 - - CR--
123
124########### test13: process_srv(), read timeout on empty response
125# setup :
126# server = nc -lp4000
127# client = (printf "GET / HTTP/1.0\r\n\r\n"; cat) | nc 127.1 8001
128# action : wait 9 seconds and check response
129# result : client exits with 504, log is emitted immediately, client must be
130# terminated by hand. Logs indicate "sH--" with correct timers.
131# example: 0/0/0/-1/8002 504 194 - - sH--
132
133########### test14: process_srv(), closed client during response timeout
134# setup :
135# server = nc6 --half-close -lp4000
136# client = (printf "GET / HTTP/1.0\r\n\r\n"; sleep 1) | nc 127.1 8001
137# action : wait 9 seconds and check response
138# result : client exits with 504, log is emitted immediately, server must be
139# terminated by hand. Logs indicate "sH--" with correct timers, which
140# is 9s total (sleep 1 + 8 for server response).
141# example: 0/0/0/-1/9002 504 194 - - sH--
142
143########### test15: process_srv(), client close causing server close
144# setup :
145# server = nc6 -lp4000
146# client = (printf "GET / HTTP/1.0\r\n\r\n"; sleep 1) | nc 127.1 8001
147# action : wait 1 second and check response
148# result : client exits with 502, log is emitted immediately, server closes.
149# Logs indicate "SH--" with correct timers.
150# example: 0/0/0/-1/1002 502 204 - - SH--
151
152########### test16: process_srv(), read timeout on server headers
153# setup :
154# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n";cat) | nc -lp4000
155# client = (printf "GET / HTTP/1.0\r\n\r\n"; cat) | nc 127.1 8001
156# action : wait 8 seconds and check response
157# result : client exits with 504, log is emitted immediately, both must be
158# terminated by hand. Logs indicate "sH--" with correct timers.
159# example: 0/0/0/-1/8004 504 223 - - sH--
160
161########### test17: process_srv(), connection time-out
162# setup :
163# config = retries 1
164# server = none
165# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8002
166# action : wait at least 12 seconds and check the logs
167# result : client returns 503 and must be terminated by hand. Log is emitted
168# immediately. Logs indicate "sC--" with correct timers.
169# example: 0/6001/-1/-1/12001 503 212 - - sC--
170
171########### test18: process_srv(), client close during connection time-out
172# setup :
173# config = retries 1
174# server = none
175# client = (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 127.1 8002
176# action : wait at least 12 seconds and check the logs
177# result : client returns 503 and automatically closes. Log is emitted
178# immediately. Logs indicate "sC--" with correct timers.
179# example: 0/6001/-1/-1/12001 503 212 - - sC--
180
181########### test19: process_srv(), immediate server close after empty response
182# setup :
183# server = echo -n | nc -lp4000
184# client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
185# action : just check logs after immediate return.
186# result : client and server exit with 502, log is emitted immediately. Logs
187# indicate "SH--" with correct timers.
188# example: 0/0/0/-1/0 502 204 - - SH--
189
190########### test20: process_srv(), immediate server close after incomplete headers
191# setup :
192# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n") | nc -lp4000
193# client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
194# action : just check logs after immediate return.
195# result : client and server exit with 502, log is emitted immediately. Logs
196# indicate "SH--" with correct timers.
197# example: 0/0/0/-1/0 502 233 - - SH--
198
199########### test21: process_srv(), immediate server close after complete headers
200# setup :
201# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
202# client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
203# action : just check logs after immediate return.
204# result : client and server exit with 200, log is emitted immediately. Logs
205# indicate "----" with correct timers.
206# example: 0/0/0/0/0 200 31 - - ----
207
208########### test22: process_srv(), timeout on request body
209# setup :
210# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
211# client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
212# action : wait 5s for the request body to timeout.
213# result : The server receives the request and responds immediately with 200.
214# Log is emitted immediately. Logs indicate "----" with correct timers.
215# example: 5002/0/0/0/5002 200 31 - - ----
216
217
218
219global
220 maxconn 100
221 log 127.0.0.1 local0
222 debug
223
224# connect to port 8000 to consult statistics
225listen stats
226 timeout client 5s
227 mode http
228 bind :8000
229 balance
230 stats uri /stat
231
232# connect port 8001 to localhost:4000
233listen frt8001
234 log global
235 bind :8001
236 mode http
237 option httplog
238 maxconn 100
239
240 timeout http-request 5s
241 timeout connect 6s
242 timeout client 7s
243 timeout server 8s
244 timeout queue 9s
245
246 balance url_param foo check_post
247 server srv4000 127.0.0.1:4000
248
249# connect port 8002 to nowhere
250listen frt8002
251 log global
252 bind :8002
253 mode http
254 option httplog
255 maxconn 100
256
257 timeout http-request 5s
258 timeout connect 6s
259 timeout client 7s
260 timeout server 8s
261 timeout queue 9s
262 retries 1
263
264 balance url_param foo check_post
265 server srv4000 192.168.255.255:4000
266
267
268# listen frt8002
269# log global
270# bind :8002
271# mode http
272# option httplog
273# maxconn 100
274#
275# timeout http-request 5s
276# timeout connect 6s
277# timeout client 7s
278# timeout server 8s
279# timeout queue 9s
280#
281# #tcp-request inspect-delay 4s
282# acl white_list src 127.0.0.2
283#
284# tcp-request content accept if white_list
285# tcp-request content reject if !REQ_CONTENT
286#
287# balance url_param foo check_post
288# #balance url_param foo #check_post
289# server srv4000 127.0.0.1:4000
290#
291# # control activity this way
292# stats uri /stat
293#