# 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 "" # 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 "" # 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 "" # 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 "" # 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 debug # 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 #