Implement runtime part of VCL controlled hashing.
The vcl_hash() is now used to control which fields go
into the hash algorithm, and the default is stil,
as previously, the URL + Host: header.
But now it is controlled by the vcl code, with the
default vcl_hash() being:
sub vcl_hash {
req.hash += req.url;
req.hash += req.http.host;
hash;
}
Once I get a bit further, this will be changed to
sub vcl_hash {
req.hash += req.url;
if (req.http.host) {
req.hash += req.http.host;
} else {
req.hash += server.ip;
}
hash;
}
So that we correctly hash HTTP requests without Host:
headers, that go to a machine with multiple IP numbers.
If you want to add fields to the hash, just write
a vcl_hash that does not end in "hash;":
sub vcl_hash {
req.hash += req.http.cookie;
}
If you want to override the default vcl_hash, just
say so:
sub vcl_hash {
req.hash += req.url;
hash; // do not continue into default vcl_hash
}
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1398
d4fa192b-c00b-0410-8231-
f00ffab90ce4