REGTESTS: http: add a test to validate chunked responses delivery

I've had this test here never committed over the last 2.5 years, that
works fine and I didn't notice it was not part of the tree. It makes a
server return odd-sized chunked responses with short pauses between half
of thems and verifies they're not truncated on the client. It may detect
eventually state machine breakages, so better commit it.

(cherry picked from commit 42faad48f619c3e0b2cada4b3fdad7e2a08aecad)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 51ca521f5ca09b17e9abf55030a9a2f607c7ea33)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5c169f82c2c96cb188284a4ded1d940de089751a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 896806164732facc970b159f073335cf32d8d768)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/reg-tests/http-messaging/truncated.vtc b/reg-tests/http-messaging/truncated.vtc
new file mode 100644
index 0000000..b731320
--- /dev/null
+++ b/reg-tests/http-messaging/truncated.vtc
@@ -0,0 +1,101 @@
+varnishtest "HTTP response size tests: H2->H1 (HTX and legacy mode)"
+#REQUIRE_VERSION=1.9
+
+feature ignore_unknown_macro
+
+server s1 {
+	rxreq
+	txresp \
+	  -status 200 \
+	  -nolen \
+	  -hdr "Transfer-encoding: chunked"
+	#  -bodylen 16300
+	#chunkedlen 16300
+	#delay 0.05
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+	chunkedlen 815
+	#delay 0.05
+	chunkedlen 815
+	delay 0.05
+} -repeat 2 -start
+
+haproxy h1 -conf {
+    defaults
+	#log stdout format raw daemon
+	mode http
+	option http-buffer-request
+	timeout connect 1s
+	timeout client  1s
+	timeout server  1s
+
+    listen feh1
+	bind "fd@${feh1}"
+	bind "fd@${feh2}" proto h2
+	http-response add-header a b
+	#http-response del-header content-length
+	server s1 ${s1_addr}:${s1_port}
+} -start
+
+client c1h2 -connect ${h1_feh2_sock} {
+	txpri
+	stream 0 {
+		txsettings
+		rxsettings
+		txsettings -ack
+		rxsettings
+		expect settings.ack == true
+	} -run
+
+	# first request is valid
+	stream 1 {
+		txreq \
+		  -req "GET" \
+		  -scheme "https" \
+		  -url "/test1.html"
+		rxhdrs
+		#delay 0.1
+		expect resp.status == 200
+		rxdata -all
+		expect resp.bodylen == 16300
+		#expext resp.chunkedlen == 16300
+	} -run
+} -repeat 2 -run