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
2968fdf2
Commit
2968fdf2
authored
Sep 19, 2013
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add '<' and '>' operators
parent
9bcf907c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
6 deletions
+66
-6
l00001.vtc
bin/varnishtest/tests/l00001.vtc
+28
-0
vsl_query.c
lib/libvarnishapi/vsl_query.c
+32
-6
vxp_parse.c
lib/libvarnishapi/vxp_parse.c
+6
-0
No files found.
bin/varnishtest/tests/l00001.vtc
View file @
2968fdf2
...
...
@@ -57,3 +57,31 @@ logexpect l1 -d 1 -g vxid -q "RespStatus != 503." {
expect * = ReqEnd
expect * = End
} -run
# Test '<' operator on integers
logexpect l1 -d 1 -g vxid -q "RespStatus < 201" {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
# Test '<' operator on floats
logexpect l1 -d 1 -g vxid -q "RespStatus < 201." {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
# Test '>' operator on integers
logexpect l1 -d 1 -g vxid -q "RespStatus > 199" {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
# Test '>' operator on floats
logexpect l1 -d 1 -g vxid -q "RespStatus > 199." {
expect * * Begin req
expect * = ReqEnd
expect * = End
} -run
lib/libvarnishapi/vsl_query.c
View file @
2968fdf2
...
...
@@ -104,11 +104,11 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
case
T_EQ
:
/* == */
switch
(
val
->
type
)
{
case
VEX_INT
:
if
(
val
->
val_int
==
rec
int
)
if
(
recint
==
val
->
val_
int
)
return
(
1
);
return
(
0
);
case
VEX_FLOAT
:
if
(
val
->
val_float
==
rec
float
)
if
(
recfloat
==
val
->
val_
float
)
return
(
1
);
return
(
0
);
default:
...
...
@@ -117,11 +117,37 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
case
T_NEQ
:
/* != */
switch
(
val
->
type
)
{
case
VEX_INT
:
if
(
val
->
val_int
!=
rec
int
)
if
(
recint
!=
val
->
val_
int
)
return
(
1
);
return
(
0
);
case
VEX_FLOAT
:
if
(
val
->
val_float
!=
recfloat
)
if
(
recfloat
!=
val
->
val_float
)
return
(
1
);
return
(
0
);
default:
WRONG
(
"Wrong value type"
);
}
case
'<'
:
/* < */
switch
(
val
->
type
)
{
case
VEX_INT
:
if
(
recint
<
val
->
val_int
)
return
(
1
);
return
(
0
);
case
VEX_FLOAT
:
if
(
recfloat
<
val
->
val_float
)
return
(
1
);
return
(
0
);
default:
WRONG
(
"Wrong value type"
);
}
case
'>'
:
switch
(
val
->
type
)
{
case
VEX_INT
:
if
(
recint
>
val
->
val_int
)
return
(
1
);
return
(
0
);
case
VEX_FLOAT
:
if
(
recfloat
>
val
->
val_float
)
return
(
1
);
return
(
0
);
default:
...
...
@@ -130,13 +156,13 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
case
T_SEQ
:
/* eq */
assert
(
val
->
type
==
VEX_STRING
);
if
(
reclen
==
val
->
val_stringlen
+
1
&&
!
strncmp
(
val
->
val_string
,
recdata
,
reclen
))
!
strncmp
(
recdata
,
val
->
val_string
,
reclen
))
return
(
1
);
return
(
0
);
case
T_SNEQ
:
/* ne */
assert
(
val
->
type
==
VEX_STRING
);
if
(
reclen
!=
val
->
val_stringlen
+
1
||
strncmp
(
val
->
val_string
,
recdata
,
reclen
))
strncmp
(
recdata
,
val
->
val_string
,
reclen
))
return
(
1
);
return
(
0
);
default:
...
...
lib/libvarnishapi/vxp_parse.c
View file @
2968fdf2
...
...
@@ -199,6 +199,10 @@ vxp_expr_cmp(struct vxp *vxp, struct vex **pvex)
/* Valid operators */
case
T_EQ
:
/* == */
case
'<'
:
/* < */
case
'>'
:
/* > */
case
T_GEQ
:
/* >= */
case
T_LEQ
:
/* <= */
case
T_NEQ
:
/* != */
case
T_SEQ
:
/* eq */
case
T_SNEQ
:
/* ne */
...
...
@@ -222,6 +226,8 @@ vxp_expr_cmp(struct vxp *vxp, struct vex **pvex)
case
'\0'
:
WRONG
(
"Missing token"
);
case
T_EQ
:
/* == */
case
'<'
:
/* < */
case
'>'
:
/* > */
case
T_GEQ
:
/* >= */
case
T_LEQ
:
/* <= */
case
T_NEQ
:
/* != */
...
...
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