• Poul-Henning Kamp's avatar
    Implement runtime part of VCL controlled hashing. · c12e7eb7
    Poul-Henning Kamp authored
    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/varnish-cache@1398 d4fa192b-c00b-0410-8231-f00ffab90ce4
    c12e7eb7
Name
Last commit
Last update
..
Makefile.am Loading commit data...
cache.h Loading commit data...
cache_acceptor.c Loading commit data...
cache_acceptor.h Loading commit data...
cache_acceptor_epoll.c Loading commit data...
cache_acceptor_kqueue.c Loading commit data...
cache_acceptor_poll.c Loading commit data...
cache_backend.c Loading commit data...
cache_ban.c Loading commit data...
cache_center.c Loading commit data...
cache_cli.c Loading commit data...
cache_expire.c Loading commit data...
cache_fetch.c Loading commit data...
cache_hash.c Loading commit data...
cache_http.c Loading commit data...
cache_main.c Loading commit data...
cache_pipe.c Loading commit data...
cache_pool.c Loading commit data...
cache_response.c Loading commit data...
cache_session.c Loading commit data...
cache_vcl.c Loading commit data...
cache_vrt.c Loading commit data...
cache_vrt_acl.c Loading commit data...
cache_vrt_re.c Loading commit data...
common.h Loading commit data...
flint.lnt Loading commit data...
flint.sh Loading commit data...
hash_classic.c Loading commit data...
hash_simple_list.c Loading commit data...
hash_slinger.h Loading commit data...
heritage.h Loading commit data...
mgt.h Loading commit data...
mgt_child.c Loading commit data...
mgt_cli.c Loading commit data...
mgt_cli.h Loading commit data...
mgt_event.c Loading commit data...
mgt_event.h Loading commit data...
mgt_param.c Loading commit data...
mgt_vcc.c Loading commit data...
rfc2616.c Loading commit data...
shmlog.c Loading commit data...
steps.h Loading commit data...
stevedore.h Loading commit data...
storage_file.c Loading commit data...
storage_malloc.c Loading commit data...
tcp.c Loading commit data...
varnishd.1 Loading commit data...
varnishd.c Loading commit data...
vclflint.lnt Loading commit data...
vclflint.sh Loading commit data...