]> err.no Git - varnish/commit
Implement runtime part of VCL controlled hashing.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 9 May 2007 14:28:50 +0000 (14:28 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 9 May 2007 14:28:50 +0000 (14:28 +0000)
commit1edee51c8a57f1bf8f2a9122656923318df440b2
tree82a8fe1900b6b0312cd4a900c75078547a586659
parentf92f2cfac11e8c98df56a9e8a3249d1556aa1940
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
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/bin/varnishd/cache_http.c
varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/bin/varnishd/hash_classic.c
varnish-cache/bin/varnishd/hash_simple_list.c
varnish-cache/bin/varnishd/mgt_vcc.c