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 | ## TCP instances connect to port 8000 and listen to 8001..8007 |
| 45 | ################################################################# |
| 46 | defaults TCP |
| 47 | timeout client 5s |
| 48 | timeout server 4s |
| 49 | timeout connect 3s |
| 50 | log global |
| 51 | 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" |
| 52 | |
| 53 | # connects to port local 8000 |
| 54 | listen tcp-none-in-none-out |
| 55 | bind :8001 |
| 56 | server s 127.0.0.1:8000 |
| 57 | |
| 58 | # takes ssl+pp on input, nothing on output |
| 59 | listen tcp-sslpp-in-none-out |
| 60 | bind :8002 ssl crt rsa2048.pem accept-proxy |
| 61 | server s 127.0.0.1:8001 |
| 62 | |
| 63 | # takes nothing on input, sends ssl+pp |
| 64 | listen tcp-none-in-sslpp-out |
| 65 | bind :8003 |
| 66 | server s 127.0.0.1:8002 ssl send-proxy-v2 |
| 67 | |
| 68 | # takes pp on input, nothing on output |
| 69 | listen tcp-pp-in-none-out |
| 70 | bind :8004 accept-proxy |
| 71 | server s 127.0.0.1:8003 |
| 72 | |
| 73 | # takes nothing on input, sends pp |
| 74 | listen tcp-none-in-pp-out |
| 75 | bind :8005 |
| 76 | server s 127.0.0.1:8004 send-proxy-v2 |
| 77 | |
| 78 | # takes ssl on input, sends nothing |
| 79 | listen tcp-ssl-in-none-out |
| 80 | bind :8006 ssl crt rsa2048.pem |
| 81 | server s 127.0.0.1:8005 |
| 82 | |
| 83 | # takes nothing on input, sends ssl |
| 84 | listen tcp-none-in-ssl-out |
| 85 | bind :8007 |
| 86 | server s 127.0.0.1:8006 ssl |
| 87 | |
| 88 | |
| 89 | ################################################################# |
| 90 | ## HTTP instances also connect to port 8000 but they listen to |
| 91 | ## 8011..8017 |
| 92 | ################################################################# |
| 93 | |
| 94 | defaults HTTP |
| 95 | timeout client 5s |
| 96 | timeout server 4s |
| 97 | timeout connect 3s |
| 98 | mode http |
| 99 | log global |
| 100 | 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" |
| 101 | |
| 102 | # connects to port local 8000 |
| 103 | listen http-none-in-none-out |
| 104 | bind :8011 |
| 105 | server s 127.0.0.1:8000 |
| 106 | |
| 107 | # takes ssl+pp on input, nothing on output |
| 108 | listen http-sslpp-in-none-out |
| 109 | bind :8012 ssl crt rsa2048.pem accept-proxy |
| 110 | server s 127.0.0.1:8011 |
| 111 | |
| 112 | # takes nothing on input, sends ssl+pp |
| 113 | listen http-none-in-sslpp-out |
| 114 | bind :8013 |
| 115 | server s 127.0.0.1:8012 ssl send-proxy-v2 |
| 116 | |
| 117 | # takes pp on input, nothing on output |
| 118 | listen http-pp-in-none-out |
| 119 | bind :8014 accept-proxy |
| 120 | server s 127.0.0.1:8013 |
| 121 | |
| 122 | # takes nothing on input, sends pp |
| 123 | listen http-none-in-pp-out |
| 124 | bind :8015 |
| 125 | server s 127.0.0.1:8014 send-proxy-v2 |
| 126 | |
| 127 | # takes ssl on input, sends nothing |
| 128 | listen http-ssl-in-none-out |
| 129 | bind :8016 ssl crt rsa2048.pem |
| 130 | server s 127.0.0.1:8015 |
| 131 | |
| 132 | # takes nothing on input, sends ssl |
| 133 | listen http-none-in-ssl-out |
| 134 | bind :8017 |
| 135 | server s 127.0.0.1:8016 ssl |