summaryrefslogtreecommitdiffstats
path: root/tests/conf/test-fsm.cfg
blob: 4ea3efd034ee4b44a4118ab8a115a037d41f9238 (plain)
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# This is a test configuration.
# It exercises some critical state machine transitions. Start it in debug
# mode with syslogd listening to UDP socket, facility local0.

########### test#0001: process_cli(), read or write error
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat /dev/zero) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001 >/dev/null
# action : kill client during transfer (Ctrl-C)
# result : both sides must close, and logs must report "CD" flags with
#          valid timers and counters. (note: high CPU usage expected)
# example: 0/0/3/0/5293 200 76420076 - - CD--

########### test#0002: process_cli(), read closed on client side first
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat /dev/zero) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
# action : end client output during transfer (Ctrl-D)
# result : client exits, log is emitted immediately, server must be terminated
#          by hand. Logs indicate "----" with correct timers.
# example: 0/0/3/0/5293 200 76420076 - - ----
# note   : test#0003 is triggered immediately after this test

########### test3: process_cli(), read closed on server side first
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
# action : end server output during transfer (Ctrl-D)
# result : server exits, log is emitted immediately, client must be terminated
#          by hand. Logs indicate "----" with correct timers.
# example: 0/0/3/0/5293 200 76420076 - - ----
# note   : test#0002 is triggered immediately after this test

########### test4: process_cli(), read timeout on client side
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
# action : wait at least 7 seconds and check the logs
# result : log is emitted immediately, client and server must be terminated
#          by hand. Logs indicate "cD--" with correct timers.
# example: 0/0/1/0/7006 200 19 - - cD--
# note   : test#0003 is triggered immediately after this test

########### test5: ability to restart read after a request buffer full
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n"; cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat 8k.txt;cat) | nc 127.1 8001
# action : enter data on the client, press enter, then Ctrl-D
# result : data transferred to the server, client exits, log is emitted
#          immediately, server must be terminated by hand. Logs indicate
#          "----" with correct timers.
# example: 0/0/0/0/3772 200 19 - - ----

########### test6: ability to restart read after a request buffer partially full
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n"; cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat 7k.txt;cat) | nc 127.1 8001
# action : enter data on the client, press enter, then Ctrl-D
# result : data transferred to the server, client exits, log is emitted
#          immediately, server must be terminated by hand. Logs indicate
#          "----" with correct timers.
# example: 0/0/0/0/3772 200 19 - - ----

########### test7: ability to restart read after a response buffer full
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat 8k.txt; cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
# action : enter data on the server, press enter, then Ctrl-D
# result : data transferred to the client, server exits, log is emitted
#          immediately, client must be terminated by hand. Logs indicate
#          "----" with correct timers.
# example: 0/0/0/0/3087 200 8242 - - ----

########### test8: ability to restart read after a response buffer partially full
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat 7k.txt; cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8001
# action : enter data on the server, press enter, then Ctrl-D
# result : data transferred to the client, server exits, log is emitted
#          immediately, client must be terminated by hand. Logs indicate
#          "----" with correct timers.
# example: 0/0/0/0/5412 200 7213 - - ----

########### test9: process_cli(), read timeout on empty request
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
#   client = nc 127.1 8001
# action : wait at least 5 seconds and check the logs
# result : client returns 408, log is emitted immediately, server must be
#          terminated by hand. Logs indicate "cR--" with correct timers
#          and "<BADREQ>"
# example: -1/-1/-1/-1/5000 408 212 - - cR--

########### test10: process_cli(), read timeout on client headers
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\nTest: test\r\n";cat) | nc 127.1 8001
# action : wait at least 5 seconds and check the logs
# result : client returns 408, log is emitted immediately, both must be
#          terminated by hand. Logs indicate "cR--" with correct timers
#          and "<BADREQ>"
# example: -1/-1/-1/-1/5004 408 212 - - cR--

########### test11: process_cli(), read abort on empty request
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
#   client = echo -n | nc 127.1 8001
# action : just check the logs after the client immediately returns
# result : client returns 400, log is emitted immediately, server must be
#          terminated by hand. Logs indicate "CR--" with correct timers
#          and "<BADREQ>"
# example: -1/-1/-1/-1/0 400 187 - - CR--

########### test12: process_cli(), read abort on client headers
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\n\r\n";cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\nTest: test\r\n") | nc 127.1 8001
# action : just check the logs after the client immediately returns
# result : client returns 400, log is emitted immediately, server must be
#          terminated by hand. Logs indicate "CR--" with correct timers
#          and "<BADREQ>"
# example: -1/-1/-1/-1/0 400 187 - - CR--

########### test13: process_srv(), read timeout on empty response
# setup :
#   server = nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n"; cat) | nc 127.1 8001
# action : wait 9 seconds and check response
# result : client exits with 504, log is emitted immediately, client must be
#          terminated by hand. Logs indicate "sH--" with correct timers.
# example: 0/0/0/-1/8002 504 194 - - sH--

########### test14: process_srv(), closed client during response timeout
# setup :
#   server = nc6 --half-close -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n"; sleep 1) | nc 127.1 8001
# action : wait 9 seconds and check response
# result : client exits with 504, log is emitted immediately, server exits
#          immediately. Logs indicate "sH--" with correct timers, which
#          is 8s regardless of the "sleep 1".
# example: 0/0/0/-1/8002 504 194 - - sH--

########### test15: process_srv(), client close not causing server close
# setup :
#   server = nc6 -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n"; sleep 1) | nc 127.1 8001
# action : wait 9 second and check response
# result : client exits with 504, log is emitted immediately, server exits
#          immediately. Logs indicate "sH--" with correct timers, which
#          is 8s regardless of the "sleep 1".
# example: 0/0/0/-1/8002 504 194 - - sH--

########### test16: process_srv(), read timeout on server headers
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n";cat) | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n"; cat) | nc 127.1 8001
# action : wait 8 seconds and check response
# result : client exits with 504, log is emitted immediately, both must be
#          terminated by hand. Logs indicate "sH--" with correct timers.
# example: 0/0/0/-1/8004 504 223 - - sH--

########### test17: process_srv(), connection time-out
# setup :
#   config = retries 1
#   server = none
#   client = (printf "GET / HTTP/1.0\r\n\r\n";cat) | nc 127.1 8002
# action : wait at least 12 seconds and check the logs
# result : client returns 503 and must be terminated by hand. Log is emitted
#          immediately. Logs indicate "sC--" with correct timers.
# example: 0/0/-1/-1/12001 503 212 - - sC--

########### test18: process_srv(), client close during connection time-out
# setup :
#   config = retries 1
#   server = none
#   client = (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 127.1 8002
# action : wait at least 12 seconds and check the logs
# result : client returns 503 and automatically closes. Log is emitted
#          immediately. Logs indicate "sC--" with correct timers.
# example: 0/0/-1/-1/12001 503 212 - - sC--

########### test19: process_srv(), immediate server close after empty response
# setup :
#   server = echo -n | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
# action : just check logs after immediate return.
# result : client and server exit with 502, log is emitted immediately. Logs
#          indicate "SH--" with correct timers.
# example: 0/0/0/-1/0 502 204 - - SH--

########### test20: process_srv(), immediate server close after incomplete headers
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n") | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
# action : just check logs after immediate return.
# result : client and server exit with 502, log is emitted immediately. Logs
#          indicate "SH--" with correct timers.
# example: 0/0/0/-1/0 502 233 - - SH--

########### test21: process_srv(), immediate server close after complete headers
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
#   client = (printf "GET / HTTP/1.0\r\n\r\n") | nc 127.1 8001
# action : just check logs after immediate return.
# result : client and server exit with 200, log is emitted immediately. Logs
#          indicate "----" with correct timers.
# example: 0/0/0/0/0 200 31 - - ----

########### test22: process_srv(), timeout on request body
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
#   client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
# action : wait 7s for the request body to timeout.
# result : The server receives the request and responds immediately with 200.
#          Log is emitted after the timeout occurs. Logs indicate "cD--" with correct timers.
# example: 1/0/0/0/7004 200 31 - - cD--

########### test23: process_srv(), client close on request body
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
#   client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
# action : wait 2s then press Ctrl-C on the client
# result : The server immediately aborts and the logs are emitted immediately with a 400.
#          Logs indicate "CD--" with correct timers.
# example: 1/0/0/0/1696 400 31 - - CD--

########### test24 process_srv(), server close on request body
# setup :
#   server = (printf "HTTP/1.0 200 OK\r\nTest: test\r\n\r\n") | nc -lp4000
#   client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8001
# action : wait 2s then press Ctrl-C on the server and press enter a few times on the client
# result : The logs are emitted immediately with a 200 (server's incomplete response).
#          Logs indicate "SD--" with correct timers. Client must be terminated by hand.
# example: 1/0/0/0/2186 200 31 - - SD--

########### test25: process_srv(), client timeout on request body when url_param is used
# setup :
#   server = none
#   client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8003
# action : wait 5s for the request body to timeout.
# result : The client receives a 408 and closes. The log is emitted immediately.
#           Logs indicate "cD--" with correct timers.
# example: 0/-1/-1/-1/5003 408 212 - - cD--

########### test26: process_srv(), client abort on request body when url_param is used
# setup :
#   server = none
#   client = (printf "POST / HTTP/1.0\r\nContent-length: 20\r\n\r\n";cat) | nc 127.1 8003
# action : wait 2s then press Ctrl-C on the client
# result : The logs are emitted immediately with a 400.
#          Logs indicate "CD--" with correct timers.
# example: 594/-1/-1/-1/594 400 187 - - CD--



global
	maxconn 100
	log		127.0.0.1 local0

# connect to port 8000 to consult statistics
listen stats
        timeout client  5s
	mode            http
	bind            :8000
	balance
	stats		uri /stat

# connect port 8001 to localhost:4000
listen  frt8001
	log		global
        bind		:8001
        mode		http
	option		httplog
        maxconn		100

        timeout http-request 5s
        timeout connect 6s
        timeout client  7s
        timeout server  8s
        timeout queue   9s

	balance		roundrobin
	server		srv4000 127.0.0.1:4000

# connect port 8002 to nowhere
listen  frt8002
	log		global
        bind		:8002
        mode		http
	option		httplog
        maxconn		100

        timeout http-request 5s
        timeout connect 6s
        timeout client  7s
        timeout server  8s
        timeout queue   9s
	retries         1

	balance		url_param foo check_post
	server		srv4000 192.168.255.255:4000

# connect port 8003 to localhost:4000 with url_param
listen  frt8003
	log		global
        bind		:8003
        mode		http
	option		httplog
        maxconn		100

        timeout http-request 5s
        timeout connect 6s
        timeout client  7s
        timeout server  8s
        timeout queue   9s

	balance		url_param foo check_post
	server		srv4000 127.0.0.1:4000


# listen  frt8002
# 	log		global
#         bind		:8002
#         mode		http
# 	option		httplog
#         maxconn		100
# 
#         timeout http-request 5s
#         timeout connect 6s
#         timeout client  7s
#         timeout server  8s
#         timeout queue   9s
# 
#         #tcp-request inspect-delay 4s
#         acl white_list src 127.0.0.2
# 
#         tcp-request content accept if white_list
#         tcp-request content reject if !REQ_CONTENT
# 
# 	balance		url_param foo check_post
# 	#balance	url_param foo #check_post
# 	server		srv4000 127.0.0.1:4000
# 
# 	# control activity this way
# 	stats		uri /stat
#