1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# 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
|