[master] da0e6c3d2 Proper END_STREAM handling

Dag Haavi Finstad daghf at varnish-software.com
Fri Jun 22 13:41:11 UTC 2018


commit da0e6c3d29dcd1c491ba99546c543917d06675b0
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date:   Fri Jun 22 15:32:10 2018 +0200

    Proper END_STREAM handling
    
    The previous commit made the assumption that END_STREAM is in the last
    of the frames in a header block. This is not necessarily the case.

diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 2a0d73b81..9dede792e 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -559,9 +559,12 @@ h2_end_headers(struct worker *wrk, struct h2_sess *h2,
 	assert(r2->state == H2_S_OPEN);
 	h2e = h2h_decode_fini(h2, r2->decode);
 	FREE_OBJ(r2->decode);
-	if (h2->rxf_flags & H2FF_HEADERS_END_STREAM)
-		r2->state = H2_S_CLOS_REM;
 	h2->new_req = NULL;
+	if (r2->req->req_body_status == REQ_BODY_NONE) {
+		/* REQ_BODY_NONE implies one of the frames in the
+		 * header block contained END_STREAM */
+		r2->state = H2_S_CLOS_REM;
+	}
 	if (h2e != NULL) {
 		Lck_Lock(&h2->sess->mtx);
 		VSLb(h2->vsl, SLT_Debug, "HPACK/FINI %s", h2e->name);


More information about the varnish-commit mailing list