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
5735a543
Commit
5735a543
authored
Feb 12, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Insist that VCL_RET_FAIL goes through VRT_fail() and not VRT_handling()
parent
31bd9182
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
10 deletions
+29
-10
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+12
-8
vcc_action.c
lib/libvcc/vcc_action.c
+4
-1
vcc_compile.c
lib/libvcc/vcc_compile.c
+13
-1
No files found.
bin/varnishd/cache/cache_vrt.c
View file @
5735a543
...
...
@@ -491,11 +491,11 @@ VRT_handling(VRT_CTX, unsigned hand)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
(
ctx
->
handling
==
NULL
)
return
;
assert
(
hand
!=
VCL_RET_FAIL
);
AN
(
ctx
->
handling
);
AZ
(
*
ctx
->
handling
);
assert
(
hand
>
0
);
assert
(
hand
<
VCL_RET_MAX
);
// XXX:NOTYET assert(*ctx->handling == 0);
*
ctx
->
handling
=
hand
;
}
...
...
@@ -507,16 +507,21 @@ VRT_fail(VRT_CTX, const char *fmt, ...)
va_list
ap
;
assert
(
ctx
->
vsl
!=
NULL
||
ctx
->
msg
!=
NULL
);
AN
(
ctx
->
handling
);
if
(
*
ctx
->
handling
==
VCL_RET_FAIL
)
return
;
AZ
(
*
ctx
->
handling
);
AN
(
fmt
);
AZ
(
strchr
(
fmt
,
'\n'
));
va_start
(
ap
,
fmt
);
if
(
ctx
->
vsl
!=
NULL
)
if
(
ctx
->
vsl
!=
NULL
)
{
VSLbv
(
ctx
->
vsl
,
SLT_VCL_Error
,
fmt
,
ap
);
else
{
}
else
{
VSB_vprintf
(
ctx
->
msg
,
fmt
,
ap
);
VSB_putc
(
ctx
->
msg
,
'\n'
);
}
va_end
(
ap
);
VRT_handling
(
ctx
,
VCL_RET_FAIL
)
;
*
ctx
->
handling
=
VCL_RET_FAIL
;
}
/*--------------------------------------------------------------------
...
...
@@ -772,9 +777,8 @@ VRT_purge(VRT_CTX, VCL_DURATION ttl, VCL_DURATION grace, VCL_DURATION keep)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
((
ctx
->
method
&
(
VCL_MET_HIT
|
VCL_MET_MISS
))
==
0
)
{
V
SLb
(
ctx
->
vsl
,
SLT_VCL_Error
,
V
RT_fail
(
ctx
,
"purge can only happen in vcl_hit{} or vcl_miss{}"
);
VRT_handling
(
ctx
,
VCL_RET_FAIL
);
return
(
0
);
}
...
...
lib/libvcc/vcc_action.c
View file @
5735a543
...
...
@@ -350,7 +350,10 @@ vcc_act_return(struct vcc *tl, struct token *t, struct symbol *sym)
}
}
ERRCHK
(
tl
);
Fb
(
tl
,
1
,
"VRT_handling(ctx, VCL_RET_%s);
\n
"
,
h
);
if
(
hand
==
VCL_RET_FAIL
)
Fb
(
tl
,
1
,
"VRT_fail(ctx,
\"
Failed from VCL
\"
);
\n
"
);
else
Fb
(
tl
,
1
,
"VRT_handling(ctx, VCL_RET_%s);
\n
"
,
h
);
SkipToken
(
tl
,
')'
);
SkipToken
(
tl
,
';'
);
}
...
...
lib/libvcc/vcc_compile.c
View file @
5735a543
...
...
@@ -318,8 +318,15 @@ EmitInitFini(const struct vcc *tl)
if
(
VSB_len
(
p
->
event
))
has_event
=
1
;
}
/* Handle failures from vcl_init */
Fc
(
tl
,
0
,
"
\n
"
);
Fc
(
tl
,
0
,
"
\t
if (*ctx->handling != VCL_RET_OK)
\n
"
);
Fc
(
tl
,
0
,
"
\t\t
return(1);
\n
"
);
VTAILQ_FOREACH
(
sy
,
&
tl
->
sym_objects
,
sideways
)
{
Fc
(
tl
,
0
,
"
\t
if (!%s) {
\n
"
,
sy
->
rname
);
Fc
(
tl
,
0
,
"
\t\t
*ctx->handling = 0;
\n
"
);
Fc
(
tl
,
0
,
"
\t\t
VRT_fail(ctx, "
"
\"
Object %s not initialized
\"
);
\n
"
,
sy
->
name
);
Fc
(
tl
,
0
,
"
\t\t
return(1);
\n
"
);
...
...
@@ -655,7 +662,12 @@ vcc_CompileSource(struct vcc *tl, struct source *sp)
/* Tie vcl_init/fini in */
ifp
=
New_IniFin
(
tl
);
VSB_printf
(
ifp
->
ini
,
"
\t
VGC_function_vcl_init(ctx);"
);
VSB_printf
(
ifp
->
ini
,
"
\t
VGC_function_vcl_init(ctx);
\n
"
);
/*
* We do not return(1) if this fails, because the failure
* could be half way into vcl_init{} so vcl_fini{} must
* always be called, also on failure.
*/
VSB_printf
(
ifp
->
fin
,
"
\t\t
VGC_function_vcl_fini(ctx);"
);
/* Emit method functions */
...
...
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