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
ac4740f2
Commit
ac4740f2
authored
Aug 22, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow a string argument to return(fail("Because!"));
Fixes #2694
parent
931ead58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
v00040.vtc
bin/varnishtest/tests/v00040.vtc
+7
-1
vcc_action.c
lib/libvcc/vcc_action.c
+18
-0
No files found.
bin/varnishtest/tests/v00040.vtc
View file @
ac4740f2
...
...
@@ -14,9 +14,15 @@ client c1 {
varnish v1 -errvcl {VCL "vcl2" Failed initialization} {
sub vcl_init {
return
(fail
);
return
(fail("Do Not Press This Button Again")
);
}
backend b1 { .host = "${s1_addr}"; }
}
varnish v1 -errvcl {Do Not Press} {
sub vcl_init {
return(fail("Do Not Press This Button Again"));
}
backend b1 { .host = "${s1_addr}"; }
}
...
...
lib/libvcc/vcc_action.c
View file @
ac4740f2
...
...
@@ -217,6 +217,22 @@ vcc_act_return_pass(struct vcc *tl)
}
/*--------------------------------------------------------------------*/
static
void
vcc_act_return_fail
(
struct
vcc
*
tl
)
{
ExpectErr
(
tl
,
'('
);
vcc_NextToken
(
tl
);
Fb
(
tl
,
1
,
"VRT_fail(ctx,
\n
"
);
tl
->
indent
+=
INDENT
;
vcc_Expr
(
tl
,
STRING
);
tl
->
indent
-=
INDENT
;
ERRCHK
(
tl
);
SkipToken
(
tl
,
')'
);
Fb
(
tl
,
1
,
");
\n
"
);
}
/*--------------------------------------------------------------------*/
static
void
vcc_act_return_synth
(
struct
vcc
*
tl
)
{
...
...
@@ -321,6 +337,8 @@ vcc_act_return(struct vcc *tl, struct token *t, struct symbol *sym)
vcc_act_return_vcl
(
tl
);
else
if
(
hand
==
VCL_RET_PASS
)
vcc_act_return_pass
(
tl
);
else
if
(
hand
==
VCL_RET_FAIL
)
vcc_act_return_fail
(
tl
);
else
{
VSB_printf
(
tl
->
sb
,
"Arguments not allowed.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
...
...
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