[PATCH 2/3] Reset output buffer on VGZ_WrwFlush()
Martin Blix Grydeland
martin at varnish-software.com
Tue Apr 3 18:29:30 CEST 2012
Fixes: #1123
---
bin/varnishd/cache/cache_gzip.c | 1 +
bin/varnishtest/tests/r01123.vtc | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
create mode 100644 bin/varnishtest/tests/r01123.vtc
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
--
1.7.4.1
More information about the varnish-dev
mailing list