Commit 0913f097 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Add y (years) time unit support to VCL

Follows the change in the std vmod a while ago.
parent e54c8aae
......@@ -73,7 +73,7 @@ varnish v1 -vcl {
}
varnish v1 -errvcl {Unknown time unit 'k'. Legal are 'ms', 's', 'm', 'h', 'd' and 'w'} {
varnish v1 -errvcl {Unknown time unit 'k'. Legal are 'ms', 's', 'm', 'h', 'd', 'w' and 'y'} {
backend b { .host = "127.0.0.1"; }
sub vcl_backend_response { set beresp.ttl = 1. k; }
}
......
......@@ -115,6 +115,8 @@ so 1.5w is allowed.
w
weeks
y
years
Integers
--------
......
......@@ -74,10 +74,12 @@ vcc_TimeUnit(struct vcc *tl)
sc = 60.0 * 60.0 * 24.0;
else if (vcc_IdIs(tl->t, "w"))
sc = 60.0 * 60.0 * 24.0 * 7.0;
else if (vcc_IdIs(tl->t, "y"))
sc = 60.0 * 60.0 * 24.0 * 365.0;
else {
VSB_printf(tl->sb, "Unknown time unit ");
vcc_ErrToken(tl, tl->t);
VSB_printf(tl->sb, ". Legal are 'ms', 's', 'm', 'h', 'd' and 'w'\n");
VSB_printf(tl->sb, ". Legal are 'ms', 's', 'm', 'h', 'd', 'w' and 'y'\n");
vcc_ErrWhere(tl, tl->t);
return (1.0);
}
......
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