[master] 516e69e Fix an indentation bug, which caused too much input data to be made "pending" if an input snippet ended with an XML comment or CDATA block.
Poul-Henning Kamp
phk at varnish-cache.org
Tue Mar 15 10:21:30 CET 2011
commit 516e69e035c431c782ea1cbfeab36cdf6e0042b7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Mar 15 09:20:03 2011 +0000
Fix an indentation bug, which caused too much input data to be made
"pending" if an input snippet ended with an XML comment or CDATA block.
Not spotted by: FlexeLint
Fixes: #873
diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index d3562fa..b80de68 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -226,6 +226,7 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, ssize_t bytes)
bytes -= w;
vef->bufp = ibuf;
VEP_parse(sp, ibuf, w);
+ assert(vef->bufp >= ibuf && vef->bufp <= ibuf + w);
if (vef->error) {
errno = vef->error;
return (-1);
diff --git a/bin/varnishd/cache_esi_parse.c b/bin/varnishd/cache_esi_parse.c
index e979b44..5e1915e 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -698,6 +698,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
vep->until_p = vep->until = "-->";
vep->until_s = VEP_NEXTTAG;
vep->state = VEP_UNTIL;
+ vep_mark_verbatim(vep, p);
break;
}
p++;
@@ -943,9 +944,9 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
vep->state = vep->until_s;
break;
}
+ }
if (p == e && !vep->remove)
vep_mark_verbatim(vep, p);
- }
} else {
Debug("*** Unknown state %s\n", vep->state);
INCOMPL();
diff --git a/bin/varnishtest/tests/r00873.vtc b/bin/varnishtest/tests/r00873.vtc
new file mode 100644
index 0000000..6797559
--- /dev/null
+++ b/bin/varnishtest/tests/r00873.vtc
@@ -0,0 +1,29 @@
+# $Id$
+
+test "Ticket #873"
+
+server s1 {
+ rxreq
+ txresp -nolen -hdr "Transfer-encoding: chunked"
+ chunked {<!-- jfsljfslkjfslkfjsljflskjflskjdj -->}
+ chunked {<![CDATA[fooooooooooooooooooobar]]>}
+ chunkedlen 0
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_fetch {
+ set beresp.do_esi = true;
+ set beresp.do_gzip = true;
+ }
+} -start
+
+client c1 {
+ txreq -hdr "Accept-Encoding: gzip"
+ rxresp
+ expect resp.http.content-encoding == gzip
+ gunzip
+ expect resp.status == 200
+ expect resp.bodylen == 75
+} -run
+
+varnish v1 -expect esi_errors == 0
More information about the varnish-commit
mailing list