Commit 12610fd5 authored by Federico G. Schwindt's avatar Federico G. Schwindt

More coverage

parent f8cdec1d
......@@ -9,40 +9,50 @@ varnish v1 -vcl+backend {
import std;
sub vcl_deliver {
set resp.http.url = std.querysort(req.url);
set resp.http.url = std.querysort(req.http.url);
}
} -start
client c1 {
txreq -url "/foo/bar?t=0&b=0&p=0&c=5"
txreq -hdr "url: /foo/bar?t=0&b=0&p=0&c=5"
rxresp
expect resp.http.url == "/foo/bar?b=0&c=5&p=0&t=0"
delay .1
txreq -url "/foo/bar?coa=0&co=0"
txreq -hdr "url: /foo/bar?coa=0&co=0"
rxresp
expect resp.http.url == "/foo/bar?co=0&coa=0"
delay .1
txreq -url "/foo/bar?a=0&&&&&"
txreq -hdr "url: /foo/bar?a=0&&&&&"
rxresp
expect resp.http.url == "/foo/bar?a=0"
txreq -url "/foo/bar?&a=0&&&&&z&w&x&"
txreq -hdr "url: /foo/bar?&a=0&&&&&z&w&x&"
rxresp
expect resp.http.url == "/foo/bar?a=0&w&x&z"
delay .1
txreq -url "/foo/bar?&"
txreq -hdr "url: /foo/bar?&"
rxresp
expect resp.http.url == "/foo/bar?"
delay .1
txreq -url "/foo/bar"
txreq -hdr "url: /foo/bar?t=0"
rxresp
expect resp.http.url == "/foo/bar?t=0"
delay .1
txreq -hdr "url: /foo/bar"
rxresp
expect resp.http.url == "/foo/bar"
txreq
rxresp
expect resp.http.url == ""
} -run
varnishtest "Test std.substr"
server s1 -repeat 2 {
server s1 {
rxreq
txresp
} -start
......@@ -9,16 +9,16 @@ varnish v1 -vcl+backend {
import std;
sub vcl_deliver {
set resp.http.sub = std.strstr(req.url, "b");
set resp.http.sub1 = std.strstr(req.http.one, "b");
set resp.http.sub2 = std.strstr(req.http.two, "b");
set resp.http.sub3 = std.strstr(req.http.unset, "b");
}
} -start
client c1 {
txreq -url "/foobar"
txreq -hdr "one: foobar" -hdr "two: quux"
rxresp
expect resp.http.sub == "bar"
txreq -url "/quux"
rxresp
expect resp.http.sub == ""
expect resp.http.sub1 == "bar"
expect resp.http.sub2 == ""
expect resp.http.sub3 == ""
} -run
......@@ -127,4 +127,7 @@ client c1 {
expect resp.http.x-date != "Wed, 29 Feb 2012 00:00:00 GMT"
delay .1
txreq
rxresp
expect resp.http.x-date != <undef>
} -run
......@@ -11,6 +11,7 @@ varnish v1 -vcl {
sub vcl_synth {
set resp.http.X-PATH = std.getenv("PATH");
set resp.http.X-unset = std.getenv(req.http.unset);
}
} -start
......@@ -18,4 +19,5 @@ client c1 {
txreq
rxresp
expect resp.http.X-PATH ~ "^/"
expect resp.http.X-unset == ""
} -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