[master] b8506b3 Test H2 Continuation headers

Poul-Henning Kamp phk at FreeBSD.org
Tue Mar 7 11:37:05 CET 2017


commit b8506b30c0453d16b5810424c64ffec71765887d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Mar 7 10:35:48 2017 +0000

    Test H2 Continuation headers

diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index 197d9f4..00c553a 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -125,21 +125,20 @@ H2_Send(struct worker *wrk, struct h2_req *r2, int flush,
 		    ftyp, flags, len, r2->stream, ptr);
 	} else {
 		AN(ptr);
-		AN(len);
 		p = ptr;
 		final_flags = ftyp->final_flags & flags;
 		flags &= ~ftyp->final_flags;
 		do {
 			AN(ftyp->continuation);
 			tf = mfs;
-			if (tf > len) {
-				tf = len;
+			if (tf < len) {
 				retval = H2_Send_Frame(wrk, h2, ftyp,
 				    flags, tf, r2->stream, p);
-				flags = 0;
 			} else {
+				tf = len;
 				retval = H2_Send_Frame(wrk, h2, ftyp,
 				    final_flags, tf, r2->stream, p);
+				flags = 0;
 			}
 			p += tf;
 			len -= tf;
diff --git a/bin/varnishtest/tests/t02007.vtc b/bin/varnishtest/tests/t02007.vtc
new file mode 100644
index 0000000..b0e329e
--- /dev/null
+++ b/bin/varnishtest/tests/t02007.vtc
@@ -0,0 +1,41 @@
+varnishtest "H2 Huge response headers"
+
+server s1 {
+	rxreq
+	expect req.proto == HTTP/1.1
+	txresp -hdr "Content-Type: text/plain" -hdrlen Foo 100 -bodylen 100
+} -start
+
+varnish v1 -vcl+backend {} -cliok "param.set feature +http2" -start
+varnish v1 -cliok "param.set debug +syncvsl"
+varnish v1 -cliok "param.set debug +h2_nocheck"
+
+client c1 {
+	stream 0 {
+		txsettings -framesize 64
+		rxsettings
+	} -run
+	stream 1 {
+		txreq \
+			-req POST \
+			-hdr content-type text/plain \
+			-nostrend \
+			-nohdrend
+		txcont \
+			-hdr expect 100-continue \
+			-hdr content-length 7 \
+			-nostrend
+
+		txdata \
+			-data request
+
+		rxhdrs
+		expect resp.status == 100
+
+		rxresp
+		expect resp.status == 200
+		expect resp.http.content-Type == "text/plain"
+		expect resp.bodylen == 100
+	} -run
+} -run
+



More information about the varnish-commit mailing list