haproxy/tests/conf/test-handshakes-chk.cfg
Willy Tarreau d4359fd98b TESTS: move tests/*.cfg to tests/config
These are a collection of test files for a variety of features (old or
more recent). 2 or 3 files were found lying there non-committed and
were moved at the same time. A few deprecated or obsolete keywords were
updated to their recent equivalent. Many of these configurations are
made to trigger different parsing errors so it is normal that plenty
of them fail.

Now the tests directory is cleaner and easier to navigate through.
2021-04-02 10:59:29 +02:00

149 lines
4.3 KiB
INI

# This config tries to involve the various possible combinations of connection
# handshakes, on the accept side and on the connect side. It also produces logs
# indicating the handshake time.
#
# May be tested with tcploop as the server, both for TCP and HTTP mode :
# - accept new connection
# - pause 100ms
# - send what looks like an HTTP response
# - wait 500ms and close
#
# Starting log server (mainly to check timers) :
# $ socat udp-recvfrom:5514,fork -
#
# Starting server :
# $ tcploop 8000 L N A W P100 S:"HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" P500
#
# Testing all combinations with server-speaks-first (tcp) :
# $ nc 0 8007
#
# Testing all combinations with client-speaks-first (tcp) :
# $ (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8007
#
# Testing all combinations with client-speaks-first after pause (tcp) :
# $ (usleep 0.05 ; printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8007
#
# Testing all combinations with client-speaks-first (http) :
# $ (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8017
#
# Testing all combinations with client-speaks-first after pause (http) :
# $ (usleep 0.05 ; printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8017
#
# Same tests must be redone after surrounding connect() in tcp_connect_server()
# with fcntl(fd, F_SETFL, 0) and fcntl(fd, F_SETFL, O_NONBLOCK) for sycnhronous
# connect().
global
stats socket /tmp/sock1 level admin
stats timeout 1h
ssl-server-verify none
tune.ssl.default-dh-param 2048
log 127.0.0.1:5514 local0 debug debug
#################################################################
## stats instance (8181)
#################################################################
listen stats
bind :8181
timeout client 5s
timeout server 4s
timeout connect 3s
mode http
stats uri /
#################################################################
## TCP instances connect to port 8000 and listen to 8001..8007
#################################################################
defaults TCP
timeout client 5s
timeout server 4s
timeout connect 3s
log global
log-format "%ci:%cp %ft %b/%s h=%Th/w=%Tw/c=%Tc/t=%Tt %ST %B %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs"
# connects to port local 8000
listen tcp-none-in-none-out
bind :8001
server s 127.0.0.1:8000 check
# takes ssl+pp on input, nothing on output
listen tcp-sslpp-in-none-out
bind :8002 ssl crt rsa2048.pem accept-proxy
server s 127.0.0.1:8001 check
# takes nothing on input, sends ssl+pp
listen tcp-none-in-sslpp-out
bind :8003
server s 127.0.0.1:8002 check ssl send-proxy-v2
# takes pp on input, nothing on output
listen tcp-pp-in-none-out
bind :8004 accept-proxy
server s 127.0.0.1:8003 check
# takes nothing on input, sends pp
listen tcp-none-in-pp-out
bind :8005
server s 127.0.0.1:8004 check send-proxy-v2
# takes ssl on input, sends nothing
listen tcp-ssl-in-none-out
bind :8006 ssl crt rsa2048.pem
server s 127.0.0.1:8005 check
# takes nothing on input, sends ssl
listen tcp-none-in-ssl-out
bind :8007
server s 127.0.0.1:8006 check ssl
#################################################################
## HTTP instances also connect to port 8000 but they listen to
## 8011..8017
#################################################################
defaults HTTP
timeout client 5s
timeout server 4s
timeout connect 3s
mode http
log global
log-format "%ci:%cp [%tr] %ft %b/%s h=%Th/i=%Ti/R=%TR/w=%Tw/c=%Tc/r=%Tr/a=%Ta/t=%Tt %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
# connects to port local 8000
listen http-none-in-none-out
bind :8011
server s 127.0.0.1:8000 check
# takes ssl+pp on input, nothing on output
listen http-sslpp-in-none-out
bind :8012 ssl crt rsa2048.pem accept-proxy
server s 127.0.0.1:8011 check
# takes nothing on input, sends ssl+pp
listen http-none-in-sslpp-out
bind :8013
server s 127.0.0.1:8012 check ssl send-proxy-v2
# takes pp on input, nothing on output
listen http-pp-in-none-out
bind :8014 accept-proxy
server s 127.0.0.1:8013 check
# takes nothing on input, sends pp
listen http-none-in-pp-out
bind :8015
server s 127.0.0.1:8014 check send-proxy-v2
# takes ssl on input, sends nothing
listen http-ssl-in-none-out
bind :8016 ssl crt rsa2048.pem
server s 127.0.0.1:8015 check
# takes nothing on input, sends ssl
listen http-none-in-ssl-out
bind :8017
server s 127.0.0.1:8016 check ssl