r3995 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests

tfheen at projects.linpro.no tfheen at projects.linpro.no
Mon Mar 23 15:23:31 CET 2009


Author: tfheen
Date: 2009-03-23 15:23:31 +0100 (Mon, 23 Mar 2009)
New Revision: 3995

Added:
   branches/2.0/varnish-cache/bin/varnishtest/tests/r00445
Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache_response.c
Log:
Merge r3965: Fix for #445:  including zero length esi objects with chunked encoding.



Modified: branches/2.0/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_response.c	2009-03-23 14:18:09 UTC (rev 3994)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_response.c	2009-03-23 14:23:31 UTC (rev 3995)
@@ -152,7 +152,9 @@
 	}
 
 	if (sp->wantbody) {
-		if (sp->esis > 0 && sp->http->protover >= 1.1) {
+		if (sp->esis > 0 &&
+		    sp->http->protover >= 1.1 &&
+		    sp->obj->len > 0) {
 			sprintf(lenbuf, "%x\r\n", sp->obj->len);
 			(void)WRW_Write(sp->wrk, lenbuf, -1);
 		}
@@ -181,7 +183,9 @@
 			(void)WRW_Write(sp->wrk, st->ptr, st->len);
 		}
 		assert(u == sp->obj->len);
-		if (sp->esis > 0 && sp->http->protover >= 1.1)
+		if (sp->esis > 0 &&
+		    sp->http->protover >= 1.1 &&
+		    sp->obj->len > 0)
 			(void)WRW_Write(sp->wrk, "\r\n", -1);
 	}
 	if (WRW_FlushRelease(sp->wrk))

Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/r00445 (from rev 3965, trunk/varnish-cache/bin/varnishtest/tests/r00445)
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/r00445	                        (rev 0)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/r00445	2009-03-23 14:23:31 UTC (rev 3995)
@@ -0,0 +1,24 @@
+# $Id$
+
+test "zero length ESI include segmens with chunked encoding"
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -body {<foo><esi:include src="/bar"><bar>}
+	rxreq
+	expect req.url == "/bar"
+	txresp 
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+		esi;
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.bodylen == 10
+} -run



More information about the varnish-commit mailing list