Commit 4c00fe8c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rename "pass" in vcl_fetch to "hit_for_pass" and respect a zerp TTL from VCL.

Make the default VCL explictly set the TTL to two minutes, decoupling
it from the default_ttl parameter.

This makes it clear that hit-for-pass happens, and makes it possible
to avoid the hit-for-pass object, (ie: get a plain pass) by setting
its ttl to zero in vcl_fetch.
parent 2fface76
......@@ -566,14 +566,11 @@ cnt_fetch(struct sess *sp)
pass = 1;
/* VCL may have fiddled this, but that doesn't help */
sp->wrk->ttl = sp->t_req - 1.;
} else if (sp->handling == VCL_RET_PASS) {
} else if (sp->handling == VCL_RET_HIT_FOR_PASS) {
/* pass from vcl_fetch{} -> hit-for-pass */
/* XXX: the bereq was not filtered pass... */
pass = 1;
sp->objcore->flags |= OC_F_PASS;
/* Enforce a minimum TTL of 1 sec (if set from VCL) */
if (sp->wrk->ttl <= sp->t_req)
sp->wrk->ttl = sp->wrk->entered + params->default_ttl;
} else {
/* regular object */
pass = 0;
......@@ -728,7 +725,7 @@ cnt_fetch(struct sess *sp)
sp->restarts++;
sp->step = STP_RECV;
return (0);
case VCL_RET_PASS:
case VCL_RET_HIT_FOR_PASS:
case VCL_RET_DELIVER:
break;
case VCL_RET_ERROR:
......
......@@ -102,14 +102,14 @@ sub vcl_miss {
}
sub vcl_fetch {
if (beresp.ttl <= 0s) {
return (pass);
}
if (beresp.http.Set-Cookie) {
return (pass);
}
if (beresp.http.Vary == "*") {
return (pass);
if (beresp.ttl <= 0s ||
beresp.http.Set-Cookie ||
beresp.http.Vary == "*") {
/*
* Mark as "Hit-For-Pass" for the next 2 minutes
*/
set beresp.ttl = 120 s;
return (hit_for_pass);
}
return (deliver);
}
......
......@@ -13,7 +13,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_fetch {
return(pass);
return(hit_for_pass);
}
} -start
......
......@@ -17,7 +17,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_fetch {
return(pass);
return(hit_for_pass);
}
} -start
......
......@@ -20,7 +20,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_fetch {
set beresp.do_esi = true;
return(pass);
return(hit_for_pass);
}
} -start
......
......@@ -10,7 +10,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_fetch {
set beresp.do_esi = true;
return(pass);
return(hit_for_pass);
}
} -start
......
......@@ -91,7 +91,7 @@ returns =(
('hash', ('hash',)),
('miss', ('error', 'restart', 'pass', 'fetch',)),
('hit', ('error', 'restart', 'pass', 'deliver',)),
('fetch', ('error', 'restart', 'pass', 'deliver',)),
('fetch', ('error', 'restart', 'hit_for_pass', 'deliver',)),
('deliver', ('restart', 'deliver',)),
('error', ('restart', 'deliver',)),
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment