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

Commit

Permalink
Merge bits of r4351 to fix off-by-one error in ESI parsing in 2.0.5
Browse files Browse the repository at this point in the history
Fixes #585


git-svn-id: http://www.varnish-cache.org/svn/branches/2.0@4379 d4fa192b-c00b-0410-8231-f00ffab90ce4
  • Loading branch information
Tollef Fog Heen committed Dec 3, 2009
1 parent 3cb4a8b commit b5dba4a
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/varnishd/cache_vrt_esi.c
Expand Up @@ -384,7 +384,7 @@ esi_handle_include(struct esi_work *ew)
memcpy(c, val.b, Tlen(val));
val.b = c;
val.e = val.b + s;
*val.e = '\0';
val.e[-1] = '\0';
}

if (Tlen(val) > 7 && !memcmp(val.b, "http://", 7)) {
Expand Down
88 changes: 88 additions & 0 deletions bin/varnishtest/tests/e00017.vtc
@@ -0,0 +1,88 @@
# $Id: e00003.vtc 3742 2009-02-11 07:53:47Z tfheen $

test "Aggressive use of ESI include"


server s1 {
rxreq
txresp -body {
<html>
Before include
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/00"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/01"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/02"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/03"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/04"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/05"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/06"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/07"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/08"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/09"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/10"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/11"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/12"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/13"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/14"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/15"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/16"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/17"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/18"/>
<esi:include src="/some/very/long/url/with/dozen/of/information/for/esi/subquery/to/munch/and/also/to/try/to/make/object/workspace/explode/by/dumping/a/core/in/some/obscure/directory/on/my/file/system/19"/>
After include
}
rxreq
txresp -body { Included file 00 }
rxreq
txresp -body { Included file 01 }
rxreq
txresp -body { Included file 02 }
rxreq
txresp -body { Included file 03 }
rxreq
txresp -body { Included file 04 }
rxreq
txresp -body { Included file 05 }
rxreq
txresp -body { Included file 06 }
rxreq
txresp -body { Included file 07 }
rxreq
txresp -body { Included file 08 }
rxreq
txresp -body { Included file 09 }
rxreq
txresp -body { Included file 10 }
rxreq
txresp -body { Included file 11 }
rxreq
txresp -body { Included file 12 }
rxreq
txresp -body { Included file 13 }
rxreq
txresp -body { Included file 14 }
rxreq
txresp -body { Included file 15 }
rxreq
txresp -body { Included file 16 }
rxreq
txresp -body { Included file 17 }
rxreq
txresp -body { Included file 18 }
rxreq
txresp -body { Included file 19 }
} -start

varnish v1 -vcl+backend {
sub vcl_fetch {
esi;
}
} -start

client c1 {
txreq
rxresp
expect resp.status == 200
}

client c1 -run
varnish v1 -expect esi_errors == 0

0 comments on commit b5dba4a

Please sign in to comment.