]> err.no Git - varnish/commitdiff
Stop processing ESI elements as soon as we discover that the client
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 27 Jan 2009 21:14:35 +0000 (21:14 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 27 Jan 2009 21:14:35 +0000 (21:14 +0000)
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

varnish-cache/bin/varnishd/cache_vrt_esi.c
varnish-cache/bin/varnishtest/tests/r00427.vtc [new file with mode: 0644]

index a75a1cf5f71d50e3e3d6d6d45cc835ce25a500a1..73079a9f7873c575f3d9da2ce755b79684e1da28 100644 (file)
@@ -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 (file)
index 0000000..416b6ab
--- /dev/null
@@ -0,0 +1,43 @@
+# $Id$
+
+test "client close in ESI delivery"
+
+server s1 {
+       rxreq
+       txresp -body {
+               <esi:include src="/foo">
+               <esi:include src="/bar">
+               <esi:include src="/barf">
+       } 
+
+       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