From 96b2e4835e573d5fade3086b238e0731891e56e8 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 21 Sep 2008 06:49:38 +0000 Subject: [PATCH] Fix #326: Don't emit zerolength verbatim strings before esi:include git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3208 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_vrt_esi.c | 8 ++++--- .../bin/varnishtest/tests/r00326.vtc | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 varnish-cache/bin/varnishtest/tests/r00326.vtc diff --git a/varnish-cache/bin/varnishd/cache_vrt_esi.c b/varnish-cache/bin/varnishd/cache_vrt_esi.c index 62df74fa..0f0f148f 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_esi.c +++ b/varnish-cache/bin/varnishd/cache_vrt_esi.c @@ -790,9 +790,11 @@ ESI_Deliver(struct sess *sp) struct object *obj; VTAILQ_FOREACH(eb, &sp->obj->esibits, list) { - WRK_Write(sp->wrk, eb->chunk_length, -1); - WRK_Write(sp->wrk, eb->verbatim.b, Tlen(eb->verbatim)); - WRK_Write(sp->wrk, "\r\n", -1); + if (Tlen(eb->verbatim)) { + WRK_Write(sp->wrk, eb->chunk_length, -1); + WRK_Write(sp->wrk, eb->verbatim.b, Tlen(eb->verbatim)); + WRK_Write(sp->wrk, "\r\n", -1); + } if (eb->include.b == NULL || sp->esis >= params->max_esi_includes) continue; diff --git a/varnish-cache/bin/varnishtest/tests/r00326.vtc b/varnish-cache/bin/varnishtest/tests/r00326.vtc new file mode 100644 index 00000000..0927a652 --- /dev/null +++ b/varnish-cache/bin/varnishtest/tests/r00326.vtc @@ -0,0 +1,23 @@ +# $Id: e00008.vtc 3012 2008-07-24 12:22:35Z des $ + +test "No zerolength verbatim before " + +server s1 { + rxreq + txresp -body {} + rxreq + txresp -body "FOO\n" +} -start + +varnish v1 -vcl+backend { + sub vcl_fetch { + esi; + } +} -start + +client c1 { + txreq + rxresp + expect resp.status == 200 + expect resp.bodylen == 8 +} -run -- 2.39.5