Commit a7ceb252 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Support IP + STRING

Fixes #2205.
parent 23705c43
......@@ -108,6 +108,10 @@ varnish v1 -vcl {
set req.http.foo = req.http.foo + "bar" ~ "bar";
set req.http.foo = req.http.foo + "bar" !~ "bar";
set req.http.foo = "foo" + req.ttl;
set req.http.foo = client.ip + ", " + server.ip;
set req.ttl = 1s;
set req.ttl *= 1.5;
set req.ttl = 1.5 s * 2.5;
......@@ -141,9 +145,6 @@ varnish v1 -vcl {
else if (4) { }
else { }
}
sub vcl_backend_response {
set beresp.http.buzz = "ttl=" + beresp.ttl;
}
}
# XXX: not the most clear error message
......@@ -238,6 +239,13 @@ varnish v1 -errvcl {DURATION + STRING not possible.} {
}
}
varnish v1 -errvcl {IP + IP not possible.} {
backend b { .host = "127.0.0.1"; }
sub vcl_recv {
set req.ttl = client.ip + server.ip;
}
}
varnish v1 -errvcl {Name of function, 'foo-bar', contains illegal character '-'} {
backend b { .host = "127.0.0.1"; }
sub foo-bar {
......
......@@ -1019,14 +1019,15 @@ static const struct adds {
{ '-', INT, REAL, REAL },
/* Error */
{ '+', TIME, INT, VOID },
{ '+', TIME, REAL, VOID },
{ '+', INT, DURATION, VOID },
{ '+', REAL, DURATION, VOID },
{ '+', DURATION, INT, VOID },
{ '+', DURATION, REAL, VOID },
{ '+', DURATION, TIME, VOID },
{ '+', DURATION, STRING, VOID },
{ '+', INT, DURATION, VOID },
{ '+', IP, IP, VOID },
{ '+', REAL, DURATION, VOID },
{ '+', TIME, INT, VOID },
{ '+', TIME, REAL, VOID },
{ EOI, VOID, VOID, VOID }
};
......@@ -1050,6 +1051,8 @@ vcc_expr_add(struct vcc *tl, struct expr **e, vcc_type_t fmt)
vcc_NextToken(tl);
if (f2 == TIME)
vcc_expr_mul(tl, &e2, DURATION);
else if (f2 == IP)
vcc_expr_mul(tl, &e2, STRING);
else
vcc_expr_mul(tl, &e2, f2);
ERRCHK(tl);
......
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