Commit b00cbb23 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Allow user defined sub{}'s to return without specifing a handling.

parent 5f0bc825
......@@ -24,3 +24,26 @@ varnish v1 -errvcl {Probe 'p1' redefined} {
probe p1 { }
backend s1 { .host = "127.0.0.1"; .probe = p1;}
}
varnish v1 -errvcl {Expected '(' got ';'} {
backend s1 { .host = "127.0.0.1"; }
sub vcl_recv { return; }
}
varnish v1 -vcl+backend {
sub foobar {
set resp.http.foo = "foo";
return;
set resp.http.foo = "bar";
}
sub vcl_deliver {
call foobar;
}
}
client c1 {
txreq
rxresp
expect resp.http.foo == "foo"
} -run
......@@ -284,6 +284,11 @@ parse_return(struct vcc *tl)
const char *h;
vcc_NextToken(tl);
if (tl->t->tok == ';' && tl->fb == tl->fc) {
/* fb == fc means we're in a subroutine */
Fb(tl, 1, "return;\n");
return;
}
ExpectErr(tl, '(');
vcc_NextToken(tl);
ExpectErr(tl, ID);
......
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