Find attached proposed patch to fix #978

Regards,
Martin

-- 
Martin Blix Grydeland
Varnish Software AS
commit aaaf1860338336426a0845fcc5441e26847b7c50
Author: Martin Blix Grydeland <[email protected]>
Date:   Tue Aug 16 22:39:08 2011 +0200

    Clear do_stream on esi_level > 0
    
    Fixes: #978

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 42d4b3b..0527743 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -717,7 +717,7 @@ cnt_fetchbody(struct sess *sp)
 	else if (sp->wrk->is_gzip)
 		sp->wrk->vfp = &vfp_testgzip;
 
-	if (sp->wrk->do_esi)
+	if (sp->wrk->do_esi || sp->esi_level > 0)
 		sp->wrk->do_stream = 0;
 	if (!sp->wantbody)
 		sp->wrk->do_stream = 0;
diff --git a/bin/varnishtest/tests/r00978.vtc b/bin/varnishtest/tests/r00978.vtc
new file mode 100644
index 0000000..39b89cb
--- /dev/null
+++ b/bin/varnishtest/tests/r00978.vtc
@@ -0,0 +1,40 @@
+varnishtest "r00978.vtc Test esi_level > 0 and do_stream"
+
+server s1 {
+	rxreq
+	expect req.url == "/"
+	txresp -body {
+		<html>
+		Before include
+		<esi:include src="/body" sr="foo"/>
+		After include
+	}
+	rxreq
+	expect req.url == "/body1"
+	txresp -body {
+		Included file
+	}
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		if (req.esi_level > 0) {
+			set req.url = req.url + req.esi_level;
+		}
+	}
+	sub vcl_fetch {
+		if (req.url == "/") {
+			set beresp.do_esi = true;
+		}
+		set beresp.do_stream = true;
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.bodylen == 65
+	expect resp.status == 200
+} -run
+
+varnish v1 -expect esi_errors == 0
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to