Commit 80233bff authored by Geoff Simmons's avatar Geoff Simmons

Enforce the order of .add() and .compile().

parent ba5da02a
......@@ -888,6 +888,30 @@ varnish v1 -errvcl {vmod selector failure: t.compile(): "foo" added more than on
}
}
varnish v1 -errvcl {vmod selector failure: s.compile(): set was already compiled} {
import ${vmod_selector};
backend b None;
sub vcl_init {
new s = selector.set();
s.add("foo");
s.compile();
s.compile();
}
}
varnish v1 -errvcl {vmod selector failure: s.add(): set was already compiled} {
import ${vmod_selector};
backend b None;
sub vcl_init {
new s = selector.set();
s.add("foo");
s.compile();
s.add("bar");
}
}
varnish v1 -vcl {
import ${vmod_selector};
backend b None;
......
......@@ -269,7 +269,10 @@ vmod_set_add(VRT_CTX, struct vmod_selector_set *set,
set->vcl_name);
return;
}
if (set->hash != NULL) {
VFAIL(ctx, "%s.add(): set was already compiled", set->vcl_name);
return;
}
if (args->arg1 == NULL) {
VFAIL(ctx, "%s.add(): string to be added is NULL",
set->vcl_name);
......@@ -358,6 +361,11 @@ vmod_set_compile(VRT_CTX, struct VPFX(selector_set) *set)
set->vcl_name);
return;
}
if (set->hash != NULL) {
VFAIL(ctx, "%s.compile(): set was already compiled",
set->vcl_name);
return;
}
members = set->members;
if (!set->case_sensitive)
......
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