Willy Tarreau | d78c0fa | 2017-03-19 06:59:29 +0100 | [diff] [blame] | 1 | # This config tries to involve the various possible combinations of connection |
| 2 | # handshakes, on the accept side and on the connect side. It also produces logs |
| 3 | # indicating the handshake time. |
| 4 | # |
| 5 | # May be tested with tcploop as the server, both for TCP and HTTP mode : |
| 6 | # - accept new connection |
| 7 | # - pause 100ms |
| 8 | # - send what looks like an HTTP response |
| 9 | # - wait 500ms and close |
| 10 | # |
| 11 | # Starting log server (mainly to check timers) : |
| 12 | # $ socat udp-recvfrom:5514,fork - |
| 13 | # |
| 14 | # Starting server : |
| 15 | # $ tcploop 8000 L N A W P100 S:"HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" P500 |
| 16 | # |
| 17 | # Testing all combinations with server-speaks-first (tcp) : |
| 18 | # $ nc 0 8007 |
| 19 | # |
| 20 | # Testing all combinations with client-speaks-first (tcp) : |
| 21 | # $ (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8007 |
| 22 | # |
| 23 | # Testing all combinations with client-speaks-first after pause (tcp) : |
| 24 | # $ (usleep 0.05 ; printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8007 |
| 25 | # |
| 26 | # Testing all combinations with client-speaks-first (http) : |
| 27 | # $ (printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8017 |
| 28 | # |
| 29 | # Testing all combinations with client-speaks-first after pause (http) : |
| 30 | # $ (usleep 0.05 ; printf "GET / HTTP/1.0\r\n\r\n";sleep 1) | nc 0 8017 |
| 31 | # |
| 32 | # Same tests must be redone after surrounding connect() in tcp_connect_server() |
| 33 | # with fcntl(fd, F_SETFL, 0) and fcntl(fd, F_SETFL, O_NONBLOCK) for sycnhronous |
| 34 | # connect(). |
| 35 | |
| 36 | global |
| 37 | stats socket /tmp/sock1 level admin |
| 38 | stats timeout 1h |
| 39 | ssl-server-verify none |
| 40 | tune.ssl.default-dh-param 2048 |
| 41 | log 127.0.0.1:5514 local0 debug debug |
| 42 | |
| 43 | ################################################################# |
| 44 | ## stats instance (8181) |
| 45 | ################################################################# |
| 46 | |
| 47 | listen stats |
| 48 | bind :8181 |
| 49 | timeout client 5s |
| 50 | timeout server 4s |
| 51 | timeout connect 3s |
| 52 | mode http |
| 53 | stats uri / |
| 54 | |
| 55 | ################################################################# |
| 56 | ## TCP instances connect to port 8000 and listen to 8001..8007 |
| 57 | ################################################################# |
| 58 | defaults TCP |
| 59 | timeout client 5s |
| 60 | timeout server 4s |
| 61 | timeout connect 3s |
| 62 | log global |
| 63 | 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" |
| 64 | |
| 65 | # connects to port local 8000 |
| 66 | listen tcp-none-in-none-out |
| 67 | bind :8001 |
| 68 | server s 127.0.0.1:8000 check |
| 69 | |
| 70 | # takes ssl+pp on input, nothing on output |
| 71 | listen tcp-sslpp-in-none-out |
| 72 | bind :8002 ssl crt rsa2048.pem accept-proxy |
| 73 | server s 127.0.0.1:8001 check |
| 74 | |
| 75 | # takes nothing on input, sends ssl+pp |
| 76 | listen tcp-none-in-sslpp-out |
| 77 | bind :8003 |
| 78 | server s 127.0.0.1:8002 check ssl send-proxy-v2 |
| 79 | |
| 80 | # takes pp on input, nothing on output |
| 81 | listen tcp-pp-in-none-out |
| 82 | bind :8004 accept-proxy |
| 83 | server s 127.0.0.1:8003 check |
| 84 | |
| 85 | # takes nothing on input, sends pp |
| 86 | listen tcp-none-in-pp-out |
| 87 | bind :8005 |
| 88 | server s 127.0.0.1:8004 check send-proxy-v2 |
| 89 | |
| 90 | # takes ssl on input, sends nothing |
| 91 | listen tcp-ssl-in-none-out |
| 92 | bind :8006 ssl crt rsa2048.pem |
| 93 | server s 127.0.0.1:8005 check |
| 94 | |
| 95 | # takes nothing on input, sends ssl |
| 96 | listen tcp-none-in-ssl-out |
| 97 | bind :8007 |
| 98 | server s 127.0.0.1:8006 check ssl |
| 99 | |
| 100 | |
| 101 | ################################################################# |
| 102 | ## HTTP instances also connect to port 8000 but they listen to |
| 103 | ## 8011..8017 |
| 104 | ################################################################# |
| 105 | |
| 106 | defaults HTTP |
| 107 | timeout client 5s |
| 108 | timeout server 4s |
| 109 | timeout connect 3s |
| 110 | mode http |
| 111 | log global |
| 112 | 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" |
| 113 | |
| 114 | # connects to port local 8000 |
| 115 | listen http-none-in-none-out |
| 116 | bind :8011 |
| 117 | server s 127.0.0.1:8000 check |
| 118 | |
| 119 | # takes ssl+pp on input, nothing on output |
| 120 | listen http-sslpp-in-none-out |
| 121 | bind :8012 ssl crt rsa2048.pem accept-proxy |
| 122 | server s 127.0.0.1:8011 check |
| 123 | |
| 124 | # takes nothing on input, sends ssl+pp |
| 125 | listen http-none-in-sslpp-out |
| 126 | bind :8013 |
| 127 | server s 127.0.0.1:8012 check ssl send-proxy-v2 |
| 128 | |
| 129 | # takes pp on input, nothing on output |
| 130 | listen http-pp-in-none-out |
| 131 | bind :8014 accept-proxy |
| 132 | server s 127.0.0.1:8013 check |
| 133 | |
| 134 | # takes nothing on input, sends pp |
| 135 | listen http-none-in-pp-out |
| 136 | bind :8015 |
| 137 | server s 127.0.0.1:8014 check send-proxy-v2 |
| 138 | |
| 139 | # takes ssl on input, sends nothing |
| 140 | listen http-ssl-in-none-out |
| 141 | bind :8016 ssl crt rsa2048.pem |
| 142 | server s 127.0.0.1:8015 check |
| 143 | |
| 144 | # takes nothing on input, sends ssl |
| 145 | listen http-none-in-ssl-out |
| 146 | bind :8017 |
| 147 | server s 127.0.0.1:8016 check ssl |
| 148 | |