[master] f992125 Reset output buffer on VGZ_WrwFlush()

Martin Blix Grydeland martin at varnish-cache.org
Mon Apr 16 16:19:46 CEST 2012


commit f992125b545fdd1d090941f2ee8b7c9cd6c29dc8
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Mar 27 17:05:49 2012 +0200

    Reset output buffer on VGZ_WrwFlush()
    
    Fixes: #1123

diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index ca40903..f7dba8e 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -366,6 +366,7 @@ VGZ_WrwFlush(const struct worker *wrk, struct vgz *vg)
 	(void)WRW_Write(wrk, vg->m_buf, vg->m_len);
 	(void)WRW_Flush(wrk);
 	vg->m_len = 0;
+	VGZ_Obuf(vg, vg->m_buf, vg->m_sz);
 }
 
 /*--------------------------------------------------------------------*/
diff --git a/bin/varnishtest/tests/r01123.vtc b/bin/varnishtest/tests/r01123.vtc
new file mode 100644
index 0000000..37a9254
--- /dev/null
+++ b/bin/varnishtest/tests/r01123.vtc
@@ -0,0 +1,25 @@
+varnishtest "Test case for #1123 - gunzip buffer reset"
+
+server s1 {
+	rxreq
+	txresp -body {<html>start <esi:include src="/included"/> end}
+	rxreq
+	expect req.url == "/included"
+	txresp -body {INCLUDED}
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+		if (req.url == "/") {
+			set beresp.do_esi = true;
+		}
+		set beresp.do_gzip = true;
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.bodylen == 24
+	expect resp.body == "<html>start INCLUDED end"
+} -run



More information about the varnish-commit mailing list