[master] efc4154 Add '!=' operator to query language
Martin Blix Grydeland
martin at varnish-cache.org
Tue Oct 1 14:48:18 CEST 2013
commit efc4154b6091cf5a72e15c297a08e0b6d1c48ed1
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Thu Sep 19 15:03:08 2013 +0200
Add '!=' operator to query language
diff --git a/bin/varnishtest/tests/l00001.vtc b/bin/varnishtest/tests/l00001.vtc
index 427435a..e9f7503 100644
--- a/bin/varnishtest/tests/l00001.vtc
+++ b/bin/varnishtest/tests/l00001.vtc
@@ -36,3 +36,10 @@ logexpect l1 -d 1 -g vxid -q "RespStatus == 200" {
expect * = ReqEnd
expect * = End
} -run
+
+# Test '!=' operator
+logexpect l1 -d 1 -g vxid -q "RespStatus != 503" {
+ expect * * Begin req
+ expect * = ReqEnd
+ expect * = End
+} -run
diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c
index 937d21f..2d4abf1 100644
--- a/lib/libvarnishapi/vsl_query.c
+++ b/lib/libvarnishapi/vsl_query.c
@@ -103,6 +103,15 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
default:
INCOMPL();
}
+ case T_NEQ: /* != */
+ switch (val->type) {
+ case VEX_INT:
+ if (val->val_int != recint)
+ return (1);
+ return (0);
+ default:
+ INCOMPL();
+ }
case T_SEQ: /* eq */
assert(val->type == VEX_STRING);
if (reclen == val->val_stringlen + 1 &&
More information about the varnish-commit
mailing list