[master] f330d35 Until our HTTP2 implementation is more comprehensive it is a feature you need to explicitly enable (params.set feature +http2)

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 5 10:22:12 CEST 2016


commit f330d354ea176292384b647318b3cde0b91b630e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 5 08:17:33 2016 +0000

    Until our HTTP2 implementation is more comprehensive it is a feature
    you need to explicitly enable (params.set feature +http2)

diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 2a4a11a..4c44102 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -393,6 +393,13 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 				WRONG("htc_status (nonbad)");
 
 			if (H2_prism_complete(req->htc) == HTC_S_COMPLETE) {
+				if (!FEATURE(FEATURE_HTTP2)) {
+					VSLb(req->vsl, SLT_Debug,
+					    "H2 attempt");
+					SES_Close(req->sp, req->doclose);
+					http1_setstate(sp, H1CLEANUP);
+					continue;
+				}
 				VSLb(req->vsl, SLT_Debug,
 				    "H2 Prior Knowledge Upgrade");
 				http1_setstate(sp, NULL);
@@ -409,10 +416,17 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 				http1_setstate(sp, H1CLEANUP);
 				continue;
 			}
-			if (req->htc->body_status == BS_NONE &&
+			if (req->htc->body_status == BS_NONE && /* XXX */
 			    http_HdrIs(req->http, H_Upgrade, "h2c")) {
+				if (!FEATURE(FEATURE_HTTP2)) {
+					VSLb(req->vsl, SLT_Debug,
+					    "H2 upgrade attempt");
+					SES_Close(req->sp, req->doclose);
+					http1_setstate(sp, H1CLEANUP);
+					continue;
+				}
 				VSLb(req->vsl, SLT_Debug,
-				    "H2 Optimistic Upgrade");
+				    "H2 Upgrade");
 				http1_setstate(sp, NULL);
 				req->err_code = 2;
 				SES_SetTransport(wrk, sp, req, &H2_transport);
diff --git a/bin/varnishtest/tests/t02000.vtc b/bin/varnishtest/tests/t02000.vtc
index 0833ca9..74e9f3b 100644
--- a/bin/varnishtest/tests/t02000.vtc
+++ b/bin/varnishtest/tests/t02000.vtc
@@ -7,6 +7,7 @@ server s1 {
 
 varnish v1 -vcl+backend {} -start
 
+varnish v1 -cliok "param.set feature +http2"
 varnish v1 -cliok "param.set debug +syncvsl"
 
 client c1 {
diff --git a/include/tbl/feature_bits.h b/include/tbl/feature_bits.h
index 7bd675f..a178b56 100644
--- a/include/tbl/feature_bits.h
+++ b/include/tbl/feature_bits.h
@@ -63,4 +63,8 @@ FEATURE_BIT(HTTPS_SCHEME,		https_scheme,
     "Also split https URIs",
     "Extract host from full URI in the request line if the scheme is https."
 )
+FEATURE_BIT(HTTP2,		http2,
+    "Support HTTP/2 protocol",
+    "Enable HTTP/2 protocol support."
+)
 /*lint -restore */



More information about the varnish-commit mailing list