Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 1 | # 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 Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 138 | # 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 Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 142 | |
Willy Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 143 | ########### test15: process_srv(), client close not causing server close |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 144 | # setup : |
| 145 | # server = nc6 -lp4000 |
| 146 | # client = (printf "GET / HTTP/1.0\r\n\r\n"; sleep 1) | nc 127.1 8001 |
Willy Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 147 | # 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 Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 152 | |
| 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 Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 170 | # example: 0/0/-1/-1/12001 503 212 - - sC-- |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 171 | |
| 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 Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 180 | # example: 0/0/-1/-1/12001 503 212 - - sC-- |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 181 | |
| 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 Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 213 | # action : wait 7s for the request body to timeout. |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 214 | # result : The server receives the request and responds immediately with 200. |
Willy Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 215 | # 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 Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 253 | |
| 254 | |
| 255 | |
| 256 | global |
| 257 | maxconn 100 |
| 258 | log 127.0.0.1 local0 |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 259 | |
| 260 | # connect to port 8000 to consult statistics |
| 261 | listen stats |
| 262 | timeout client 5s |
| 263 | mode http |
| 264 | bind :8000 |
| 265 | balance |
| 266 | stats uri /stat |
| 267 | |
| 268 | # connect port 8001 to localhost:4000 |
| 269 | listen frt8001 |
| 270 | log global |
| 271 | bind :8001 |
| 272 | mode http |
| 273 | option httplog |
| 274 | maxconn 100 |
| 275 | |
| 276 | timeout http-request 5s |
| 277 | timeout connect 6s |
| 278 | timeout client 7s |
| 279 | timeout server 8s |
| 280 | timeout queue 9s |
| 281 | |
Willy Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 282 | balance roundrobin |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 283 | server srv4000 127.0.0.1:4000 |
| 284 | |
| 285 | # connect port 8002 to nowhere |
| 286 | listen frt8002 |
| 287 | log global |
| 288 | bind :8002 |
| 289 | mode http |
| 290 | option httplog |
| 291 | maxconn 100 |
| 292 | |
| 293 | timeout http-request 5s |
| 294 | timeout connect 6s |
| 295 | timeout client 7s |
| 296 | timeout server 8s |
| 297 | timeout queue 9s |
| 298 | retries 1 |
| 299 | |
| 300 | balance url_param foo check_post |
| 301 | server srv4000 192.168.255.255:4000 |
| 302 | |
Willy Tarreau | 4098aab | 2010-06-07 13:50:26 +0200 | [diff] [blame] | 303 | # connect port 8003 to localhost:4000 with url_param |
| 304 | listen frt8003 |
| 305 | log global |
| 306 | bind :8003 |
| 307 | mode http |
| 308 | option httplog |
| 309 | maxconn 100 |
| 310 | |
| 311 | timeout http-request 5s |
| 312 | timeout connect 6s |
| 313 | timeout client 7s |
| 314 | timeout server 8s |
| 315 | timeout queue 9s |
| 316 | |
| 317 | balance url_param foo check_post |
| 318 | server srv4000 127.0.0.1:4000 |
| 319 | |
Willy Tarreau | c22b57d | 2008-08-17 19:30:03 +0200 | [diff] [blame] | 320 | |
| 321 | # listen frt8002 |
| 322 | # log global |
| 323 | # bind :8002 |
| 324 | # mode http |
| 325 | # option httplog |
| 326 | # maxconn 100 |
| 327 | # |
| 328 | # timeout http-request 5s |
| 329 | # timeout connect 6s |
| 330 | # timeout client 7s |
| 331 | # timeout server 8s |
| 332 | # timeout queue 9s |
| 333 | # |
| 334 | # #tcp-request inspect-delay 4s |
| 335 | # acl white_list src 127.0.0.2 |
| 336 | # |
| 337 | # tcp-request content accept if white_list |
| 338 | # tcp-request content reject if !REQ_CONTENT |
| 339 | # |
| 340 | # balance url_param foo check_post |
| 341 | # #balance url_param foo #check_post |
| 342 | # server srv4000 127.0.0.1:4000 |
| 343 | # |
| 344 | # # control activity this way |
| 345 | # stats uri /stat |
| 346 | # |