From: phk Date: Tue, 27 Jan 2009 21:14:35 +0000 (+0000) Subject: Stop processing ESI elements as soon as we discover that the client X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=286cd02aa9bb1a5be54b3735f6139bd1c3285b76;p=varnish Stop processing ESI elements as soon as we discover that the client has closed the connection on us. Fixes #427 git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3547 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_vrt_esi.c b/varnish-cache/bin/varnishd/cache_vrt_esi.c index a75a1cf5..73079a9f 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_esi.c +++ b/varnish-cache/bin/varnishd/cache_vrt_esi.c @@ -862,6 +862,8 @@ ESI_Deliver(struct sess *sp) sp->esis--; sp->obj = obj; WRW_Reserve(sp->wrk, &sp->fd); + if (sp->fd < 0) + break; } if (sp->esis == 0 && sp->http->protover >= 1.1) (void)WRW_Write(sp->wrk, "0\r\n\r\n", -1); diff --git a/varnish-cache/bin/varnishtest/tests/r00427.vtc b/varnish-cache/bin/varnishtest/tests/r00427.vtc new file mode 100644 index 00000000..416b6aba --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/r00427.vtc @@ -0,0 +1,43 @@ +# $Id$ + +test "client close in ESI delivery" + +server s1 { + rxreq + txresp -body { + + + + } + + rxreq + expect req.url == "/foo" + sema r1 sync 2 + sema r1 sync 2 + txresp -body "[foo]" + + rxreq + expect req.url == "/bar" + txresp -body "[bar]" + + rxreq + expect req.url == "/barf" + txresp -body "[barf]" +} -start + +varnish v1 -vcl+backend { + sub vcl_fetch { + esi; + } +} -start + +client c1 { + txreq + sema r1 sync 2 +} -run + +client c1 { + sema r1 sync 2 + txreq + rxresp +} -run