blob: cbb8a7b0b94aeb4f626300f123dcdb4b0836ce19 [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"
12
13feature ignore_unknown_macro
14
15syslog Slog_1 -repeat 8 -level info {
16 recv
17 expect ~ "Connect from .* to ${h1_ssl_addr}:${h1_ssl_port}"
18 recv
19 expect ~ "ssl-offload-http/http .* \"POST /[1-8] HTTP/1\\.1\""
20} -start
21
22haproxy h1 -conf {
23 global
24 nbproc 4
25 nbthread 4
26 tune.ssl.default-dh-param 2048
27 stats bind-process 1
28 log ${Slog_1_addr}:${Slog_1_port} len 2048 local0 debug err
29
30 defaults
31 mode http
32 timeout client 1s
33 timeout server 1s
34 timeout connect 1s
35 log global
36
37 listen http
38 bind-process 1
PiBa-NLd3ff20f2018-10-03 23:54:49 +020039 bind unix@${testdir}/http.socket accept-proxy name ssl-offload-http
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020040 option forwardfor
41
42 listen ssl-offload-http
43 option httplog
44 bind-process 2-4
45 bind "fd@${ssl}" ssl crt ${testdir}/common.pem ssl no-sslv3 alpn h2,http/1.1
PiBa-NLd3ff20f2018-10-03 23:54:49 +020046 server http unix@${testdir}/http.socket send-proxy
Frédéric Lécailleafbfa2a2018-08-24 16:14:28 +020047} -start
48
49
50shell {
51 HOST=${h1_ssl_addr}
52 if [ "$HOST" = "::1" ] ; then
53 HOST="\[::1\]"
54 fi
55 for i in 1 2 3 4 5 6 7 8 ; do
56 urls="$urls https://$HOST:${h1_ssl_port}/$i"
57 done
58 curl -i -k -d 'x=x' $urls & wait $!
59}
60
61syslog Slog_1 -wait