blob: 8fcf2655bda1f3a6a1783b4022f0406a740bc870 [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
Willy Tarreau4098aab2010-06-07 13:50:26 +0200138# result : client exits with 504, log is emitted immediately, server exits
139# immediately. Logs indicate "sH--" with correct timers, which
140# is 8s regardless of the "sleep 1".
141# example: 0/0/0/-1/8002 504 194 - - sH--
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200142
Willy Tarreau4098aab2010-06-07 13:50:26 +0200143########### test15: process_srv(), client close not causing server close
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200144# setup :
145# server = nc6 -lp4000
146# client = (printf "GET / HTTP/1.0\r\n\r\n"; sleep 1) | nc 127.1 8001
Willy Tarreau4098aab2010-06-07 13:50:26 +0200147# action : wait 9 second and check response
148# result : client exits with 504, log is emitted immediately, server exits
149# immediately. Logs indicate "sH--" with correct timers, which
150# is 8s regardless of the "sleep 1".
151# example: 0/0/0/-1/8002 504 194 - - sH--
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200152
153########### test16: process_srv(), read timeout on server headers
154# setup :
155# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n";cat) | nc -lp4000
156# client = (printf "GET / HTTP/1.0\r\n\r\n"; cat) | nc 127.1 8001
157# action : wait 8 seconds and check response
158# result : client exits with 504, log is emitted immediately, both must be
159# terminated by hand. Logs indicate "sH--" with correct timers.
160# example: 0/0/0/-1/8004 504 223 - - sH--
161
162########### test17: process_srv(), connection time-out
163# setup :
164# config = retries 1
165# server = none
166# client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8002
167# action : wait at least 12 seconds and check the logs
168# result : client returns 503 and must be terminated by hand. Log is emitted
169# immediately. Logs indicate "sC--" with correct timers.
Willy Tarreau4098aab2010-06-07 13:50:26 +0200170# example: 0/0/-1/-1/12001 503 212 - - sC--
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200171
172########### test18: process_srv(), client close during connection time-out
173# setup :
174# config = retries 1
175# server = none
176# client = (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 127.1 8002
177# action : wait at least 12 seconds and check the logs
178# result : client returns 503 and automatically closes. Log is emitted
179# immediately. Logs indicate "sC--" with correct timers.
Willy Tarreau4098aab2010-06-07 13:50:26 +0200180# example: 0/0/-1/-1/12001 503 212 - - sC--
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200181
182########### test19: process_srv(), immediate server close after empty response
183# setup :
184# server = echo -n | nc -lp4000
185# client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
186# action : just check logs after immediate return.
187# result : client and server exit with 502, log is emitted immediately. Logs
188# indicate "SH--" with correct timers.
189# example: 0/0/0/-1/0 502 204 - - SH--
190
191########### test20: process_srv(), immediate server close after incomplete headers
192# setup :
193# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n") | nc -lp4000
194# client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
195# action : just check logs after immediate return.
196# result : client and server exit with 502, log is emitted immediately. Logs
197# indicate "SH--" with correct timers.
198# example: 0/0/0/-1/0 502 233 - - SH--
199
200########### test21: process_srv(), immediate server close after complete headers
201# setup :
202# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
203# client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
204# action : just check logs after immediate return.
205# result : client and server exit with 200, log is emitted immediately. Logs
206# indicate "----" with correct timers.
207# example: 0/0/0/0/0 200 31 - - ----
208
209########### test22: process_srv(), timeout on request body
210# setup :
211# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
212# client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
Willy Tarreau4098aab2010-06-07 13:50:26 +0200213# action : wait 7s for the request body to timeout.
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200214# result : The server receives the request and responds immediately with 200.
Willy Tarreau4098aab2010-06-07 13:50:26 +0200215# Log is emitted after the timeout occurs. Logs indicate "cD--" with correct timers.
216# example: 1/0/0/0/7004 200 31 - - cD--
217
218########### test23: process_srv(), client close on request body
219# setup :
220# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
221# client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
222# action : wait 2s then press Ctrl-C on the client
223# result : The server immediately aborts and the logs are emitted immediately with a 400.
224# Logs indicate "CD--" with correct timers.
225# example: 1/0/0/0/1696 400 31 - - CD--
226
227########### test24 process_srv(), server close on request body
228# setup :
229# server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
230# client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
231# action : wait 2s then press Ctrl-C on the server and press enter a few times on the client
232# result : The logs are emitted immediately with a 200 (server's incomplete response).
233# Logs indicate "SD--" with correct timers. Client must be terminated by hand.
234# example: 1/0/0/0/2186 200 31 - - SD--
235
236########### test25: process_srv(), client timeout on request body when url_param is used
237# setup :
238# server = none
239# client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8003
240# action : wait 5s for the request body to timeout.
241# result : The client receives a 408 and closes. The log is emitted immediately.
242# Logs indicate "cD--" with correct timers.
243# example: 0/-1/-1/-1/5003 408 212 - - cD--
244
245########### test26: process_srv(), client abort on request body when url_param is used
246# setup :
247# server = none
248# client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8003
249# action : wait 2s then press Ctrl-C on the client
250# result : The logs are emitted immediately with a 400.
251# Logs indicate "CD--" with correct timers.
252# example: 594/-1/-1/-1/594 400 187 - - CD--
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200253
254
255
256global
257 maxconn 100
258 log 127.0.0.1 local0
259 debug
260
261# connect to port 8000 to consult statistics
262listen stats
263 timeout client 5s
264 mode http
265 bind :8000
266 balance
267 stats uri /stat
268
269# connect port 8001 to localhost:4000
270listen frt8001
271 log global
272 bind :8001
273 mode http
274 option httplog
275 maxconn 100
276
277 timeout http-request 5s
278 timeout connect 6s
279 timeout client 7s
280 timeout server 8s
281 timeout queue 9s
282
Willy Tarreau4098aab2010-06-07 13:50:26 +0200283 balance roundrobin
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200284 server srv4000 127.0.0.1:4000
285
286# connect port 8002 to nowhere
287listen frt8002
288 log global
289 bind :8002
290 mode http
291 option httplog
292 maxconn 100
293
294 timeout http-request 5s
295 timeout connect 6s
296 timeout client 7s
297 timeout server 8s
298 timeout queue 9s
299 retries 1
300
301 balance url_param foo check_post
302 server srv4000 192.168.255.255:4000
303
Willy Tarreau4098aab2010-06-07 13:50:26 +0200304# connect port 8003 to localhost:4000 with url_param
305listen frt8003
306 log global
307 bind :8003
308 mode http
309 option httplog
310 maxconn 100
311
312 timeout http-request 5s
313 timeout connect 6s
314 timeout client 7s
315 timeout server 8s
316 timeout queue 9s
317
318 balance url_param foo check_post
319 server srv4000 127.0.0.1:4000
320
Willy Tarreauc22b57d2008-08-17 19:30:03 +0200321
322# listen frt8002
323# log global
324# bind :8002
325# mode http
326# option httplog
327# maxconn 100
328#
329# timeout http-request 5s
330# timeout connect 6s
331# timeout client 7s
332# timeout server 8s
333# timeout queue 9s
334#
335# #tcp-request inspect-delay 4s
336# acl white_list src 127.0.0.2
337#
338# tcp-request content accept if white_list
339# tcp-request content reject if !REQ_CONTENT
340#
341# balance url_param foo check_post
342# #balance url_param foo #check_post
343# server srv4000 127.0.0.1:4000
344#
345# # control activity this way
346# stats uri /stat
347#