blob: 1ae33deb974aeaa401387e48478d21ee08ee38e7 [file] [log] [blame]
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +02001#commit b406b87
2# BUG/MEDIUM: connection: don't store recv() result into trash.data
3#
4# Cyril Bonté discovered that the proxy protocol randomly fails since
5# commit 843b7cb ("MEDIUM: chunks: make the chunk struct's fields match
6# the buffer struct"). This is because we used to store recv()'s return
7# code into trash.data which is now unsigned, so it never compares as
8# negative against 0. Let's clean this up and test the result itself
9# without storing it first.
10
11varnishtest "PROXY protocol random failures"
Ilya Shipitsin9ab31382019-04-17 12:19:56 +050012#REQUIRE_OPTIONS=OPENSSL
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020013
14feature ignore_unknown_macro
15
Willy Tarreau41378892020-11-21 15:33:03 +010016#REGTEST_TYPE=broken
Frédéric Lécailledc1a3bd2019-03-29 15:07:24 +010017
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020018syslog Slog_1 -repeat 8 -level info {
19 recv
20 expect ~ "Connect from .* to ${h1_ssl_addr}:${h1_ssl_port}"
21 recv
Christopher Faulet452e5782019-10-14 16:22:03 +020022 expect ~ "ssl-offload-http/http .* \"POST (https://.*:${h1_ssl_port})?/[1-8] HTTP/(2\\.0|1\\.1)\""
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020023} -start
24
25haproxy h1 -conf {
26 global
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020027 tune.ssl.default-dh-param 2048
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020028 log ${Slog_1_addr}:${Slog_1_port} len 2048 local0 debug err
29
30 defaults
31 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010032 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
33 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
34 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020035 log global
36
37 listen http
Frédéric Lécaillea7029472018-12-20 09:55:44 +010038 bind unix@"${tmpdir}/http.socket" accept-proxy name ssl-offload-http
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020039 option forwardfor
40
41 listen ssl-offload-http
42 option httplog
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020043 bind "fd@${ssl}" ssl crt ${testdir}/common.pem ssl no-sslv3 alpn h2,http/1.1
Frédéric Lécaillea7029472018-12-20 09:55:44 +010044 server http unix@"${tmpdir}/http.socket" send-proxy
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020045} -start
46
47
48shell {
49 HOST=${h1_ssl_addr}
50 if [ "$HOST" = "::1" ] ; then
51 HOST="\[::1\]"
52 fi
53 for i in 1 2 3 4 5 6 7 8 ; do
54 urls="$urls https://$HOST:${h1_ssl_port}/$i"
55 done
56 curl -i -k -d 'x=x' $urls & wait $!
57}
58
59syslog Slog_1 -wait