From: Olivier Houchard Date: Tue, 17 Nov 2026 15:37:38 +0000 (+0100) Subject: REGTESTS: http-messaging: check that 1xx don't abort H2 backend tunnels X-Git-Url: https://git.kaiwu.me/web/%22data:,/doc/static/gitweb.js?a=commitdiff_plain;h=c6ddc7b38ccbe9e08190266c258228248c4a0cda;p=haproxy.git REGTESTS: http-messaging: check that 1xx don't abort H2 backend tunnels This test sends a CONNECT request, then an Extended CONNECT request (via an H1 upgrade), through H2 backends whose servers answer with an interim response then with a 200 response, and checks that data may then be exchanged in the tunnel. It validates the previous fix. --- diff --git a/reg-tests/http-messaging/h2_connect_1xx.vtc b/reg-tests/http-messaging/h2_connect_1xx.vtc new file mode 100644 index 000000000..ac4e0fc53 --- /dev/null +++ b/reg-tests/http-messaging/h2_connect_1xx.vtc @@ -0,0 +1,92 @@ +# This test checks that an interim response (1xx) received from an H2 server +# for a CONNECT or an Extended CONNECT request does not abort the tunnel +# attempt: the final 200 response must still establish the tunnel and data +# must be exchanged. + +varnishtest "H2 backend: interim response before the 200 of a CONNECT tunnel" +feature ignore_unknown_macro + +server s1 { + rxpri + stream 0 { + txsettings + rxsettings + txsettings -ack + } -run + stream 1 { + rxhdrs + expect req.method == "CONNECT" + txresp -status 103 -nostrend + txresp -status 200 -nostrend + rxwinup + rxdata + expect frame.data == "ping" + txdata -data "pong" + } -run +} -start + +# H2 server supporting RFC8441 (SETTINGS_ENABLE_CONNECT_PROTOCOL) +server s2 { + rxpri + stream 0 { + sendhex "00 00 06 04 00 00 00 00 00 00 08 00 00 00 01" + rxsettings + txsettings -ack + rxsettings + expect settings.ack == true + } -run + stream 1 { + rxhdrs + expect req.method == "CONNECT" + expect req.http.:protocol == "custom_protocol" + txresp -status 100 -nostrend + txresp -status 200 -nostrend + rxwinup + rxdata + expect frame.data == "ping" + txdata -data "pong" + } -run +} -start + +haproxy h1 -conf { + defaults + mode http + timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" + timeout client "${HAPROXY_TEST_TIMEOUT-5s}" + timeout server "${HAPROXY_TEST_TIMEOUT-5s}" + + frontend fe + bind "fd@${fe}" + default_backend be + + backend be + server s1 ${s1_addr}:${s1_port} proto h2 + + frontend fe_ext + bind "fd@${fe_ext}" + default_backend be_ext + + backend be_ext + server s2 ${s2_addr}:${s2_port} proto h2 +} -start + +client c1 -connect ${h1_fe_sock} { + txreq -method CONNECT -url "example.com:443" -hdr "host: example.com:443" + rxresp + expect resp.status == 103 + rxresphdrs + expect resp.status == 200 + send "ping" + recv 4 +} -run + +client c2 -connect ${h1_fe_ext_sock} { + txreq -url "/" -hdr "host: 127.0.0.1" -hdr "connection: upgrade" -hdr "upgrade: custom_protocol" + rxresphdrs + expect resp.status == 100 + rxresphdrs + expect resp.status == 101 + expect resp.http.upgrade == "custom_protocol" + send "ping" + recv 4 +} -run