[master] 17ad98c With table-driven MUST handling, some checks become simpler.

Poul-Henning Kamp phk at FreeBSD.org
Sat Mar 4 20:01:05 CET 2017


commit 17ad98cdac9d0a4228adb1be0325b1cbb6f9ce6b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sat Mar 4 19:00:01 2017 +0000

    With table-driven MUST handling, some checks become simpler.

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index dd7f61c..264ff90 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -223,8 +223,11 @@ static h2_error __match_proto__(h2_frame_f)
 h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 {
 	(void)wrk;
-	(void)h2;
-	(void)r2;
+	
+	if (h2->rxf_len != 4)			// rfc7540,l,2003,2004
+		return (H2CE_FRAME_SIZE_ERROR);
+	if (r2 == NULL)
+		return (0);
 	INCOMPL();
 	NEEDLESS(return (H2CE_PROTOCOL_ERROR));
 }
@@ -622,19 +625,7 @@ h2_procframe(struct worker *wrk, struct h2_sess *h2)
 		if (r2->stream == h2->rxf_stream)
 			break;
 
-	if (h2->rxf_type == H2_FRAME_RST_STREAM) {
-		/* Special case RST_STREAM to avoid creating streams */
-		if (h2->rxf_len != 4)			// rfc7540,l,2003,2004
-			return (H2CE_FRAME_SIZE_ERROR);
-		if (h2->rxf_stream == 0)		// rfc7540,l,1993,1996
-			return (H2CE_PROTOCOL_ERROR);
-		if (h2->rxf_stream > h2->highest_stream)// rfc7540,l,1998,2001
-			return (H2CE_PROTOCOL_ERROR);
-		if (r2 == NULL)
-			return (0);
-	}
-
-	if (r2 == NULL) {
+	if (r2 == NULL && h2f->act_sidle == 0) {
 		if (h2->rxf_stream <= h2->highest_stream)
 			return (H2CE_PROTOCOL_ERROR);	// rfc7540,l,1153,1158
 		h2->highest_stream = h2->rxf_stream;
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index f63445c..15c5fbd 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -156,7 +156,7 @@ h2_new_req(const struct worker *wrk, struct h2_sess *h2,
 }
 
 static void
-h2_del_req(struct worker *wrk, struct h2_req *r2)
+h2_del_req(struct worker *wrk, const struct h2_req *r2)
 {
 	struct h2_sess *h2;
 	struct sess *sp;



More information about the varnish-commit mailing list