Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 12e571b3eb
Fetching contributors…

Cannot retrieve contributors at this time

54 lines (39 sloc) 0.765 kb
varnishtest "Hash director"
server s1 {
rxreq
txresp -hdr "Foo: 1" -body "1"
rxreq
txresp -hdr "Foo: 3" -body "3"
} -start
server s2 {
rxreq
txresp -hdr "Foo: 2" -body "2"
rxreq
txresp -hdr "Foo: 4" -body "4"
} -start
varnish v1 -vcl+backend {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
sub vcl_init {
new h1 = directors.hash();
h1.add_backend(s1, 1);
h1.add_backend(s2, 1);
}
sub vcl_recv {
set req.backend = h1.backend(req.url);
return(pass);
}
} -start
client c1 {
txreq -url /1
rxresp
expect resp.http.foo == "1"
txreq -url /3
rxresp
expect resp.http.foo == "2"
txreq -url /13
rxresp
expect resp.http.foo == "3"
txreq -url /8
rxresp
expect resp.http.foo == "4"
} -run
Jump to Line
Something went wrong with that request. Please try again.