[master] afb5c06 Don't assert on missing HTTP2-Settings header
Dag Haavi Finstad
daghf at varnish-software.com
Fri Jun 23 14:52:05 CEST 2017
commit afb5c068957eee0920568ed1c73448fae91fab7e
Author: Dag Haavi Finstad <daghf at varnish-software.com>
Date: Thu Jun 8 13:46:36 2017 +0200
Don't assert on missing HTTP2-Settings header
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 0e04a84..80f50aa 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -155,9 +155,9 @@ h2_b64url_settings(struct h2_sess *h2, struct req *req)
* If there is trouble with this, we could reject the upgrade
* but putting this on the H1 side is just plain wrong...
*/
- AN(http_GetHdr(req->http, H_HTTP2_Settings, &p));
- if (p == NULL)
+ if (!http_GetHdr(req->http, H_HTTP2_Settings, &p))
return (-1);
+ AN(p);
VSLb(req->vsl, SLT_Debug, "H2CS %s", p);
n = 0;
diff --git a/bin/varnishtest/tests/t02001.vtc b/bin/varnishtest/tests/t02001.vtc
index d744822..1da6fb3 100644
--- a/bin/varnishtest/tests/t02001.vtc
+++ b/bin/varnishtest/tests/t02001.vtc
@@ -139,3 +139,20 @@ varnish v1 -expect MEMPOOL.req0.live == 0
varnish v1 -expect MEMPOOL.req1.live == 0
varnish v1 -expect MEMPOOL.sess0.live == 0
varnish v1 -expect MEMPOOL.sess1.live == 0
+
+
+client c1 {
+ # Missing HTTP2-Settings
+ send "GET /noupgrade HTTP/1.1\r\n"
+ send "Host: foo.bar\r\n"
+ send "Upgrade: h2c\r\n"
+ send "\r\n"
+ expect_close
+} -run
+
+varnish v1 -vsl_catchup
+
+varnish v1 -expect MEMPOOL.req0.live == 0
+varnish v1 -expect MEMPOOL.req1.live == 0
+varnish v1 -expect MEMPOOL.sess0.live == 0
+varnish v1 -expect MEMPOOL.sess1.live == 0
More information about the varnish-commit
mailing list