diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c index 0e04a843a2..80f50aa63a 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 d74482200d..1da6fb3b57 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