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

phk at projects.linpro.no phk at projects.linpro.no
Wed Feb 3 00:37:43 CET 2010


Author: phk
Date: 2010-02-03 00:37:43 +0100 (Wed, 03 Feb 2010)
New Revision: 4529

Added:
   trunk/varnish-cache/bin/varnishtest/tests/r00524.vtc
Modified:
   trunk/varnish-cache/bin/varnishd/cache_response.c
Log:
When serving ESI to HTTP/1.0 clients, we use EOF mode.  Remeber to
properly close the connection when doing so.

Fixes 524



Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2010-02-02 07:09:48 UTC (rev 4528)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2010-02-02 23:37:43 UTC (rev 4529)
@@ -151,6 +151,8 @@
 		if(sp->http->protover >= 1.1)
 			http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp,
 			    "Transfer-Encoding: chunked");
+		else 
+			sp->doclose = "ESI EOF";
 	}
 
 	TIM_format(TIM_real(), time_str);

Added: trunk/varnish-cache/bin/varnishtest/tests/r00524.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00524.vtc	                        (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00524.vtc	2010-02-02 23:37:43 UTC (rev 4529)
@@ -0,0 +1,33 @@
+# $Id$
+
+test "Regression test for 524: HTTP/1.0 and ESI"
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -body {
+		<esi:remove> </esi:remove> 
+		<esi:include src="/foo"/>
+		<esi:remove> </esi:remove> 
+	}
+
+	rxreq
+	txresp -body "<foo>"
+
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		// return (pass);
+	}
+	sub vcl_fetch {
+		esi;
+	}
+} -cliok "param.set sess_timeout 60" -start
+
+client c1 {
+	txreq -proto HTTP/1.0 -hdr "Connection: kEep-alive"
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 18
+} -run



More information about the varnish-commit mailing list