[master] 03602d9 Don't panic if people send us HTTP2.0 when it is not enabled.

Poul-Henning Kamp phk at FreeBSD.org
Wed Feb 1 21:58:05 CET 2017


commit 03602d9fb9e89379c648ad95df11bcc69dd1d004
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 1 20:56:20 2017 +0000

    Don't panic if people send us HTTP2.0 when it is not enabled.
    
    Explains some of #2117 and friends

diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 094294c..06eb34b 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -401,10 +401,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 
 			if (H2_prism_complete(req->htc) == HTC_S_COMPLETE) {
 				if (!FEATURE(FEATURE_HTTP2)) {
-					VSLb(req->vsl, SLT_Debug,
-					    "H2 attempt");
-					assert(req->doclose > 0);
-					SES_Close(req->sp, req->doclose);
+					SES_Close(req->sp, SC_REQ_HTTP20);
 					http1_setstate(sp, H1CLEANUP);
 					continue;
 				}
@@ -412,8 +409,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 				    "H2 Prior Knowledge Upgrade");
 				http1_setstate(sp, NULL);
 				req->err_code = 1;
-				SES_SetTransport(wrk, sp, req,
-				    &H2_transport);
+				SES_SetTransport(wrk, sp, req, &H2_transport);
 				return;
 			}
 
diff --git a/include/tbl/sess_close.h b/include/tbl/sess_close.h
index e1b4872..0dcbcbc 100644
--- a/include/tbl/sess_close.h
+++ b/include/tbl/sess_close.h
@@ -44,7 +44,8 @@ SESS_CLOSE(TX_EOF,	  tx_eof,	0,	"EOF transmission")
 SESS_CLOSE(RESP_CLOSE,	  resp_close,	0,	"Backend/VCL requested close")
 SESS_CLOSE(OVERLOAD,	  overload,	1,	"Out of some resource")
 SESS_CLOSE(PIPE_OVERFLOW, pipe_overflow,1,	"Session pipe overflow")
-SESS_CLOSE(RANGE_SHORT,   range_short,  1,	"Insufficient data for range")
+SESS_CLOSE(RANGE_SHORT,   range_short,	1,	"Insufficient data for range")
+SESS_CLOSE(REQ_HTTP20,	  req_http20,	1,	"HTTP2 not accepted")
 #undef SESS_CLOSE
 
 /*lint -restore */



More information about the varnish-commit mailing list