r3547 - in trunk/varnish-cache/bin: varnishd varnishtest/tests

phk at projects.linpro.no phk at projects.linpro.no
Tue Jan 27 22:14:35 CET 2009


Author: phk
Date: 2009-01-27 22:14:35 +0100 (Tue, 27 Jan 2009)
New Revision: 3547

Added:
   trunk/varnish-cache/bin/varnishtest/tests/r00427.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
Log:
Stop processing ESI elements as soon as we discover that the client
has closed the connection on us.

Fixes	#427



Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2009-01-27 12:18:12 UTC (rev 3546)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c	2009-01-27 21:14:35 UTC (rev 3547)
@@ -862,6 +862,8 @@
 		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);

Added: trunk/varnish-cache/bin/varnishtest/tests/r00427.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00427.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00427.vtc	2009-01-27 21:14:35 UTC (rev 3547)
@@ -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



More information about the varnish-commit mailing list