1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
varnishtest "Test std.querysort"
server s1 -repeat 6 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
import std;
sub vcl_deliver {
set resp.http.url = std.querysort(req.http.url);
}
} -start
client c1 {
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 -hdr "url: /foo/bar?coa=0&co=0"
rxresp
expect resp.http.url == "/foo/bar?co=0&coa=0"
delay .1
txreq -hdr "url: /foo/bar?a=0&&&&&"
rxresp
expect resp.http.url == "/foo/bar?a=0"
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 -hdr "url: /foo/bar?&"
rxresp
expect resp.http.url == "/foo/bar?"
delay .1
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
|