Commit cc513fdc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix a VCL expression type error: TIME +/- DURATION should return TIME

Fixes	#1211

Thanks to:	Federico G. Schwindt
parent 968d11d1
varnishtest "TIME +/- DURATION -> TIME"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_deliver {
set resp.http.bar = now + 4 d;
set resp.http.foo = now - 4 d;
}
} -start
client c1 {
txreq
rxresp
expect resp.http.bar ~ "..., .. ... 20[1-9][0-9] ..:..:.. GMT"
expect resp.http.foo ~ "..., .. ... 20[1-9][0-9] ..:..:.. GMT"
} -run
......@@ -847,6 +847,9 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
ERRCHK(tl);
if (tk->tok == '-' && (*e)->fmt == TIME && e2->fmt == TIME) {
/* OK */
} else if ((*e)->fmt == TIME && e2->fmt == DURATION) {
f2 = TIME;
/* OK */
} else if (tk->tok == '-' &&
(*e)->fmt == BYTES && e2->fmt == BYTES) {
/* OK */
......
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