Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
Merge r3965: Fix for #445: including zero length esi objects with chu…
Browse files Browse the repository at this point in the history
…nked encoding.

git-svn-id: http://www.varnish-cache.org/svn/branches/2.0@3995 d4fa192b-c00b-0410-8231-f00ffab90ce4
  • Loading branch information
Tollef Fog Heen committed Mar 23, 2009
1 parent 5a5fc4e commit f830477
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/varnishd/cache_response.c
Expand Up @@ -152,7 +152,9 @@ RES_WriteObj(struct sess *sp)
}

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);
}
Expand Down Expand Up @@ -181,7 +183,9 @@ RES_WriteObj(struct sess *sp)
(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))
Expand Down
24 changes: 24 additions & 0 deletions bin/varnishtest/tests/r00445
@@ -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

0 comments on commit f830477

Please sign in to comment.