[master] bc823a062 Move header block frame sequence check earlier

Dag Haavi Finstad daghf at varnish-software.com
Fri Oct 5 08:50:16 UTC 2018


commit bc823a062d23148cb6f76a94a3c8eb27db964939
Author: Carlo Cannas <carlo94 at gmail.com>
Date:   Sun Sep 23 03:34:02 2018 +0200

    Move header block frame sequence check earlier
    
    This moves it before the new stream object creation, so we save ourselves an
    useless allocation and initialization of a stream object which would be never
    used and straight killed.
    
    This also simplifies upcoming commits.

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 070bf2cad..b106f9e36 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -923,6 +923,10 @@ h2_procframe(struct worker *wrk, struct h2_sess *h2, h2_frame h2f)
 		if (r2->stream == h2->rxf_stream)
 			break;
 
+	if (h2->new_req != NULL &&
+	    !(r2 && h2->new_req == r2->req && h2f == H2_F_CONTINUATION))
+		return (H2CE_PROTOCOL_ERROR);	// rfc7540,l,1859,1863
+
 	if (r2 == NULL && h2f->act_sidle == 0) {
 		if (h2->rxf_stream <= h2->highest_stream)
 			return (H2CE_PROTOCOL_ERROR);	// rfc7540,l,1153,1158
@@ -940,10 +944,6 @@ h2_procframe(struct worker *wrk, struct h2_sess *h2, h2_frame h2f)
 		AN(r2);
 	}
 
-	if (h2->new_req != NULL &&
-	    !(r2 && h2->new_req == r2->req && h2f == H2_F_CONTINUATION))
-		return (H2CE_PROTOCOL_ERROR);	// rfc7540,l,1859,1863
-
 	h2e = h2f->rxfunc(wrk, h2, r2);
 	if (h2e == 0)
 		return (0);
diff --git a/bin/varnishtest/tests/r02387.vtc b/bin/varnishtest/tests/r02387.vtc
index 34863a057..d2c9796e7 100644
--- a/bin/varnishtest/tests/r02387.vtc
+++ b/bin/varnishtest/tests/r02387.vtc
@@ -30,7 +30,7 @@ client c1 {
 	} -run
 	stream 0 {
 		rxgoaway
-		expect goaway.laststream == "3"
+		expect goaway.laststream == "1"
 		expect goaway.err == PROTOCOL_ERROR
 	} -run
 } -run


More information about the varnish-commit mailing list