From d64e574301d8f81d01ca38b0e578f9484cd8fd0f Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 19 Sep 2008 20:20:10 +0000 Subject: [PATCH] Make sure we always close the client connection if we pass through vcl_error{} git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3204 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_center.c | 4 ++++ .../bin/varnishtest/tests/b00017.vtc | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 varnish-cache/bin/varnishtest/tests/b00017.vtc diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 3aab12e5..097a739d 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -305,6 +305,10 @@ cnt_error(struct sess *sp) char date[40]; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + + /* We always close when we take this path */ + sp->doclose = "error"; + w = sp->wrk; if (sp->obj == NULL) { HSH_Prealloc(sp); diff --git a/varnish-cache/bin/varnishtest/tests/b00017.vtc b/varnish-cache/bin/varnishtest/tests/b00017.vtc new file mode 100644 index 00000000..352428e4 --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/b00017.vtc @@ -0,0 +1,20 @@ +# $Id$ + +test "Check that we close one error" + +varnish v1 -vcl { + backend foo { + .host = "127.0.0.2"; + .port = "9080"; + } + sub vcl_recv { + error 888; + } +} -start + +client c1 { + txreq -url "/" + rxresp + expect resp.status == 888 + expect resp.http.connection == close +} -run -- 2.39.5