Commit b3c61816 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add regsub test case so I don't break it again.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2740 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 742b44e4
# $Id$
test "Test VCL regsub()"
server s1 {
rxreq
txresp \
-hdr "Foobar: barf" \
-hdr "Connection: close" \
-body "012345\n"
}
varnish v1 -vcl+backend {
sub vcl_fetch {
set obj.http.Snafu1 = regsub(obj.http.Foobar, "ar", "&&");
set obj.http.Snafu2 =
regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$4$3$2p");
set obj.http.Snafu3 =
regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$4\$$3$2p");
set obj.http.Snafu4 =
regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$4\&$3$2p");
set obj.http.Snafu5 =
regsub(obj.http.Foobar, "(b)(a)(r)(f)", "$$$4$3$2\$p");
}
} -start
server s1 -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 200
expect resp.http.X-Varnish == "1001"
expect resp.http.foobar == "barf"
expect resp.http.snafu1 == "bararf"
expect resp.http.snafu2 == "frap"
expect resp.http.snafu3 == "f$rap"
expect resp.http.snafu4 == "f&rap"
expect resp.http.snafu5 == "barffra$p"
}
client c1 -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment