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
b8816994
Commit
b8816994
authored
Feb 06, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement fail in vcl_hit{} and vcl_deliver{}
parent
1567375b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
6 deletions
+69
-6
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+6
-0
v00051.vtc
bin/varnishtest/tests/v00051.vtc
+61
-4
generate.py
lib/libvcc/generate.py
+2
-2
No files found.
bin/varnishd/cache/cache_req_fsm.c
View file @
b8816994
...
...
@@ -117,6 +117,9 @@ cnt_deliver(struct worker *wrk, struct req *req)
case
VCL_RET_RESTART
:
req
->
req_step
=
R_STP_RESTART
;
break
;
case
VCL_RET_FAIL
:
req
->
req_step
=
R_STP_VCLFAIL
;
break
;
case
VCL_RET_SYNTH
:
req
->
req_step
=
R_STP_SYNTH
;
break
;
...
...
@@ -474,6 +477,9 @@ cnt_lookup(struct worker *wrk, struct req *req)
case
VCL_RET_RESTART
:
req
->
req_step
=
R_STP_RESTART
;
break
;
case
VCL_RET_FAIL
:
req
->
req_step
=
R_STP_VCLFAIL
;
break
;
case
VCL_RET_SYNTH
:
req
->
req_step
=
R_STP_SYNTH
;
break
;
...
...
bin/varnishtest/tests/v00051.vtc
View file @
b8816994
...
...
@@ -232,9 +232,6 @@ logexpect l1 -wait
varnish v1 -vcl+backend {
import debug;
sub vcl_recv {
if (req.http.foo == "miss") { return(hash); }
}
sub vcl_miss {
if (req.http.foo == "miss") {
debug.fail();
...
...
@@ -250,7 +247,7 @@ logexpect l1 -v v1 -g raw {
} -start
client c1 {
txreq -url /
x
-hdr "foo: miss"
txreq -url /
miss
-hdr "foo: miss"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
...
...
@@ -260,3 +257,63 @@ varnish v1 -expect sc_vcl_failure == 8
logexpect l1 -wait
#######################################################################
# Fail in vcl_hit
varnish v1 -vcl+backend {
import debug;
sub vcl_hit {
if (req.http.foo == "hit") {
debug.fail();
set req.http.not = "Should not happen";
}
}
}
logexpect l1 -v v1 -g raw {
expect * 1020 VCL_call "HIT"
expect 0 1020 Debug "Forced failure"
expect 0 1020 VCL_return "fail"
} -start
client c1 {
txreq -url /hit -hdr "foo: hit"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run
varnish v1 -expect sc_vcl_failure == 9
logexpect l1 -wait
#######################################################################
# Fail in vcl_deliver
varnish v1 -vcl+backend {
import debug;
sub vcl_deliver {
if (req.http.foo == "deliver") {
debug.fail();
set req.http.not = "Should not happen";
}
}
}
logexpect l1 -v v1 -g raw {
expect * 1022 VCL_call "DELIVER"
expect 0 1022 Debug "Forced failure"
expect 0 1022 VCL_return "fail"
} -start
client c1 {
txreq -url /hit -hdr "foo: deliver"
rxresp
expect resp.status == 503
expect resp.reason == "VCL failed"
} -run
varnish v1 -expect sc_vcl_failure == 10
logexpect l1 -wait
lib/libvcc/generate.py
View file @
b8816994
...
...
@@ -114,11 +114,11 @@ returns = (
),
(
'hit'
,
"C"
,
(
'synth'
,
'restart'
,
'pass'
,
'miss'
,
'deliver'
,)
(
'
fail'
,
'
synth'
,
'restart'
,
'pass'
,
'miss'
,
'deliver'
,)
),
(
'deliver'
,
"C"
,
(
'synth'
,
'restart'
,
'deliver'
,)
(
'
fail'
,
'
synth'
,
'restart'
,
'deliver'
,)
),
(
'synth'
,
"C"
,
...
...
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