Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
7c3ab258
Commit
7c3ab258
authored
Sep 16, 2016
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow duration types in boolean contexts
Polish test while here.
parent
e8420fd1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
50 deletions
+10
-50
v00016.vtc
bin/varnishtest/tests/v00016.vtc
+0
-5
v00020.vtc
bin/varnishtest/tests/v00020.vtc
+3
-39
vcl.rst
doc/sphinx/reference/vcl.rst
+2
-1
vcc_expr.c
lib/libvcc/vcc_expr.c
+5
-5
No files found.
bin/varnishtest/tests/v00016.vtc
View file @
7c3ab258
...
...
@@ -78,11 +78,6 @@ varnish v1 -errvcl {Unknown time unit 'k'. Legal are 'ms', 's', 'm', 'h', 'd',
sub vcl_backend_response { set beresp.ttl = 1. k; }
}
varnish v1 -errvcl {Expression has type DURATION, expected BOOL} {
backend b { .host = "127.0.0.1"; }
sub vcl_backend_response { if (beresp.ttl *= 2) { } }
}
varnish v1 -errvcl {Operator > not possible on BACKEND} {
backend a { .host = "127.0.0.1"; }
backend b { .host = "127.0.0.1"; }
...
...
bin/varnishtest/tests/v00020.vtc
View file @
7c3ab258
...
...
@@ -58,14 +58,6 @@ varnish v1 -errvcl {Unknown token '-' when looking for DURATION} {
}
}
varnish v1 -errvcl {'&&' must be followed by BOOL, found DURATION.} {
sub vcl_recv {
if (req.ttl < 3s && req.ttl) {
set req.http.foo = vcl_recv;
}
}
}
varnish v1 -errvcl {Operator * not possible on type STRING.} {
sub vcl_recv {
set req.http.foo = "bla" * "foo";
...
...
@@ -78,13 +70,6 @@ varnish v1 -errvcl {DURATION + INT not possible.} {
}
}
varnish v1 -errvcl {'!' must be followed by BOOL, found DURATION.} {
sub vcl_backend_response {
if (! req.ttl) {
}
}
}
varnish v1 -errvcl {BOOL + BOOL not possible.} {
sub vcl_backend_response {
if (beresp.do_gzip + beresp.do_gunzip) {
...
...
@@ -124,16 +109,11 @@ varnish v1 -vcl {
set req.http.foo = req.http.foo + "bar" !~ "bar";
set req.ttl = 1s;
}
}
if (req.ttl) { }
if (!req.ttl) { }
varnish v1 -vcl {
import std;
backend b { .host = "127.0.0.1"; }
sub vcl_recv {
if (std.integer("1", 1)) {
}
if (1) { }
}
}
...
...
@@ -251,22 +231,6 @@ varnish v1 -errvcl {DURATION + STRING not possible.} {
}
}
varnish v1 -errvcl {'||' must be followed by BOOL, found DURATION.} {
backend b { .host = "127.0.0.1"; }
sub vcl_backend_response {
if (req.url || beresp.ttl) {
}
}
}
varnish v1 -errvcl {'&&' must be followed by BOOL, found DURATION.} {
backend b { .host = "127.0.0.1"; }
sub vcl_backend_response {
if (req.url && beresp.ttl) {
}
}
}
varnish v1 -vcl {
backend b { .host = "127.0.0.1"; }
sub vcl_miss {
...
...
doc/sphinx/reference/vcl.rst
View file @
7c3ab258
...
...
@@ -93,7 +93,8 @@ their value.
String types will evaluate to *false* if they are empty; backend types
will evalute to *false* if they don't have a backend assigned; integer
types will evaluate to *false* if their value is zero.
types will evaluate to *false* if their value is zero; duration types
will evaluate to *false* if their value is equal or less than zero.
Time
~~~~
...
...
lib/libvcc/vcc_expr.c
View file @
7c3ab258
...
...
@@ -1200,12 +1200,12 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, vcc_type_t fmt)
default:
break
;
}
if
(
fmt
==
BOOL
&&
((
*
e
)
->
fmt
==
STRING
||
(
*
e
)
->
fmt
==
BACKEND
||
(
*
e
)
->
fmt
==
INT
))
{
*
e
=
vcc_expr_edit
(
BOOL
,
"(
\v
1 != 0)"
,
*
e
,
NULL
);
if
(
fmt
!=
BOOL
)
return
;
}
if
((
*
e
)
->
fmt
==
STRING
||
(
*
e
)
->
fmt
==
BACKEND
||
(
*
e
)
->
fmt
==
INT
)
*
e
=
vcc_expr_edit
(
BOOL
,
"(
\v
1 != 0)"
,
*
e
,
NULL
);
else
if
((
*
e
)
->
fmt
==
DURATION
)
*
e
=
vcc_expr_edit
(
BOOL
,
"(
\v
1 > 0)"
,
*
e
,
NULL
);
}
/*--------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment