[master] 77cab36 Start hammering away on H2 again

Poul-Henning Kamp phk at FreeBSD.org
Fri Feb 17 12:36:05 CET 2017


commit 77cab3676155ac3f45db4176795f5621e12be8e6
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Feb 16 10:06:39 2017 +0000

    Start hammering away on H2 again

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 82e4f8a..04fc842 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -400,7 +400,6 @@ h2_rx_headers(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 	 * read frames and proper error handling.
 	 */
 
-	xxxassert(h2->rxf_stream & 1);
 	xxxassert(r2->state == H2_S_IDLE);
 	r2->state = H2_S_OPEN;
 
@@ -429,7 +428,11 @@ h2_rx_headers(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 	/* XXX: Error handling */
 	p = h2->rxf_data;
 	l = h2->rxf_len;
-	if (h2->rxf_flags & 0x20) {
+	if (h2->rxf_flags & H2FF_HEADERS_PADDED) {
+		l -= 1 + *p;
+		p += 1;
+	}
+	if (h2->rxf_flags & H2FF_HEADERS_PRIORITY) {
 		p += 5;
 		l -= 5;
 	}
@@ -518,6 +521,15 @@ h2_rxframe(struct worker *wrk, struct h2_sess *h2)
 
 	h2_vsl_frame(h2, h2->htc->rxbuf_b, 9L + h2->rxf_len);
 
+	if (h2->rxf_stream != 0 && !(h2->rxf_stream & 1)) {
+		/* We don't do push, so all streams must be zero or odd# */
+		Lck_Lock(&h2->sess->mtx);
+		VSLb(h2->vsl, SLT_Debug, "H2: illegal stream (=%u)",
+		    h2->rxf_stream);
+		Lck_Unlock(&h2->sess->mtx);
+		return (0);
+	}
+
 	Lck_Lock(&h2->sess->mtx);
 	VTAILQ_FOREACH(r2, &h2->streams, list)
 		if (r2->stream == h2->rxf_stream)
@@ -544,7 +556,10 @@ h2_rxframe(struct worker *wrk, struct h2_sess *h2)
 		break;
 #include "tbl/h2_frames.h"
 	default:
-		INCOMPL();
+		VSLb(h2->vsl, SLT_Debug, "H2: Bad frame type 0x%02x on ",
+		    h2->htc->rxbuf_b[3]);
+		Lck_Unlock(&h2->sess->mtx);
+		return (0);
 	}
 	Lck_Unlock(&h2->sess->mtx);
 	return (1);
diff --git a/bin/varnishtest/tests/t02000.vtc b/bin/varnishtest/tests/t02000.vtc
index 7ebf4b3..2cd7610 100644
--- a/bin/varnishtest/tests/t02000.vtc
+++ b/bin/varnishtest/tests/t02000.vtc
@@ -13,7 +13,7 @@ varnish v1 -cliok "param.set debug +syncvsl"
 
 client c1 {
 	stream 1 {
-		txprio -weight 10 -stream 0
+		txprio -weight 10 -stream 0 
 	} -run
 	stream 3 {
 		txprio -weight 10 -stream 0
@@ -22,7 +22,7 @@ client c1 {
 		txprio -weight 10 -stream 2
 	} -run
 	stream 7 {
-		txreq -hdr :authority foo.bar
+		txreq -hdr :authority foo.bar -pad cotton
 		rxresp
 		expect resp.status == 200
 	} -start



More information about the varnish-commit mailing list