Ignore:
Timestamp:
2007-05-09 15:28:50 (7 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
2.0, 2.1, tags/varnish-2.0, tags/varnish-2.0-beta1, tags/varnish-2.0-beta1@3141, tags/varnish-2.0-beta2, tags/varnish-2.0-beta2@3221, tags/varnish-2.0-rc1, tags/varnish-2.0-rc1@3266, tags/varnish-2.0-tp1, tags/varnish-2.0-tp1@2734, tags/varnish-2.0-tp2, tags/varnish-2.0-tp2@2803, tags/varnish-2.0.1, tags/varnish-2.0.2, tags/varnish-2.0.3, tags/varnish-2.0.4, tags/varnish-2.0.5, tags/varnish-2.0.6, tags/varnish-2.1.0, tags/varnish-2.1.1, tags/varnish-2.1.2, tags/varnish-2.1.3, tags/varnish-2.1.4
Children:
83924d
Parents:
8fd8d4
git-author:
Poul-Henning Kamp <phk@…> (2007-05-09 15:28:50)
git-committer:
Poul-Henning Kamp <phk@…> (2007-05-09 15:28:50)
Message:

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:  http://www.varnish-cache.org/svn/trunk@1398 d4fa192b-c00b-0410-8231-f00ffab90ce4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache_http.c

    r6a3a2c rf5176a  
    541541        assert(hp->t > hp->s); 
    542542        assert(hp->t <= hp->v); 
     543        hp->f = hp->v; 
    543544        return (1); 
    544545} 
Note: See TracChangeset for help on using the changeset viewer.