Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 1 | #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 | |
| 11 | varnishtest "PROXY protocol random failures" |
Ilya Shipitsin | 9ab3138 | 2019-04-17 12:19:56 +0500 | [diff] [blame] | 12 | #REQUIRE_OPTIONS=OPENSSL |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 13 | |
| 14 | feature ignore_unknown_macro |
| 15 | |
Willy Tarreau | 4137889 | 2020-11-21 15:33:03 +0100 | [diff] [blame] | 16 | #REGTEST_TYPE=broken |
Frédéric Lécaille | dc1a3bd | 2019-03-29 15:07:24 +0100 | [diff] [blame] | 17 | |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 18 | syslog Slog_1 -repeat 8 -level info { |
| 19 | recv |
| 20 | expect ~ "Connect from .* to ${h1_ssl_addr}:${h1_ssl_port}" |
| 21 | recv |
Christopher Faulet | 452e578 | 2019-10-14 16:22:03 +0200 | [diff] [blame] | 22 | expect ~ "ssl-offload-http/http .* \"POST (https://.*:${h1_ssl_port})?/[1-8] HTTP/(2\\.0|1\\.1)\"" |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 23 | } -start |
| 24 | |
| 25 | haproxy h1 -conf { |
| 26 | global |
| 27 | nbproc 4 |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 28 | tune.ssl.default-dh-param 2048 |
| 29 | stats bind-process 1 |
| 30 | log ${Slog_1_addr}:${Slog_1_port} len 2048 local0 debug err |
| 31 | |
| 32 | defaults |
| 33 | mode http |
Christopher Faulet | 8f16148 | 2018-12-19 11:49:39 +0100 | [diff] [blame] | 34 | ${no-htx} option http-use-htx |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 35 | timeout client 1s |
| 36 | timeout server 1s |
| 37 | timeout connect 1s |
| 38 | log global |
| 39 | |
| 40 | listen http |
| 41 | bind-process 1 |
Frédéric Lécaille | a702947 | 2018-12-20 09:55:44 +0100 | [diff] [blame] | 42 | bind unix@"${tmpdir}/http.socket" accept-proxy name ssl-offload-http |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 43 | option forwardfor |
| 44 | |
| 45 | listen ssl-offload-http |
| 46 | option httplog |
| 47 | bind-process 2-4 |
| 48 | bind "fd@${ssl}" ssl crt ${testdir}/common.pem ssl no-sslv3 alpn h2,http/1.1 |
Frédéric Lécaille | a702947 | 2018-12-20 09:55:44 +0100 | [diff] [blame] | 49 | server http unix@"${tmpdir}/http.socket" send-proxy |
Frédéric Lécaille | afbfa2a | 2018-08-24 16:14:28 +0200 | [diff] [blame] | 50 | } -start |
| 51 | |
| 52 | |
| 53 | shell { |
| 54 | HOST=${h1_ssl_addr} |
| 55 | if [ "$HOST" = "::1" ] ; then |
| 56 | HOST="\[::1\]" |
| 57 | fi |
| 58 | for i in 1 2 3 4 5 6 7 8 ; do |
| 59 | urls="$urls https://$HOST:${h1_ssl_port}/$i" |
| 60 | done |
| 61 | curl -i -k -d 'x=x' $urls & wait $! |
| 62 | } |
| 63 | |
| 64 | syslog Slog_1 -wait |