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

More coverage

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