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
a4c8ffa4
Commit
a4c8ffa4
authored
Aug 16, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable VCL switching from VCL
parent
2d1c4679
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
1 deletion
+82
-1
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+8
-0
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+2
-0
c00077.vtc
bin/varnishtest/tests/c00077.vtc
+71
-0
generate.py
lib/libvcc/generate.py
+1
-1
No files found.
bin/varnishd/cache/cache_req_fsm.c
View file @
a4c8ffa4
...
...
@@ -688,6 +688,8 @@ cnt_recv(struct worker *wrk, struct req *req)
}
VCL_recv_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
NULL
);
if
(
wrk
->
handling
==
VCL_RET_VCL
)
VCL_recv_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
NULL
);
/* Attempts to cache req.body may fail */
if
(
req
->
req_body_status
==
REQ_BODY_FAIL
)
{
...
...
@@ -714,6 +716,12 @@ cnt_recv(struct worker *wrk, struct req *req)
SHA256_Final
(
req
->
digest
,
&
sha256ctx
);
switch
(
recv_handling
)
{
case
VCL_RET_VCL
:
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"return(vcl) only allowed from active (top) VCL."
);
req
->
err_code
=
503
;
req
->
req_step
=
R_STP_SYNTH
;
return
(
REQ_FSM_MORE
);
case
VCL_RET_PURGE
:
req
->
req_step
=
R_STP_PURGE
;
return
(
REQ_FSM_MORE
);
...
...
bin/varnishd/cache/cache_vcl.c
View file @
a4c8ffa4
...
...
@@ -453,6 +453,8 @@ VRT_vcl_select(VRT_CTX, VCL_VCL vcl)
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
VCL_Rel
(
&
req
->
vcl
);
vcl_get
(
&
req
->
vcl
,
vcl
);
/* XXX: better logging */
VSLb
(
ctx
->
req
->
vsl
,
SLT_Debug
,
"Now using %s VCL"
,
vcl
->
loaded_name
);
}
struct
vclref
*
...
...
bin/varnishtest/tests/c00077.vtc
0 → 100644
View file @
a4c8ffa4
varnishtest "Switching VCL from VCL"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_deliver {
set resp.http.vcl = "vclA";
}
} -start
varnish v1 -clierr 106 "vcl.label vcl.A vcl1"
varnish v1 -cliok "vcl.label vclA vcl1"
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.vcl == "vcl1") {
return (vcl(vclA));
}
}
sub vcl_deliver {
set resp.http.vcl = "vcl2";
}
}
varnish v1 -cliok "vcl.label vclB vcl2"
varnish v1 -cliok "vcl.list"
client c1 {
txreq
rxresp
expect resp.http.vcl == vcl2
txreq -hdr "vcl: vcl1"
rxresp
expect resp.http.vcl == vclA
} -run
varnish v1 -clierr 106 "vcl.discard vcl1"
varnish v1 -vcl+backend { sub vcl_recv { return (vcl(vclB)); } }
client c1 {
txreq -hdr "vcl: vcl1"
rxresp
expect resp.status == 503
} -run
delay .2
varnish v1 -vcl+backend { sub vcl_recv { return (vcl(vclA)); } }
varnish v1 -vcl+backend { sub vcl_recv { return (vcl(vclA)); } }
varnish v1 -vcl+backend { sub vcl_recv { return (vcl(vclA)); } }
varnish v1 -vcl+backend { sub vcl_recv { return (vcl(vclA)); } }
varnish v1 -clierr 106 "vcl.discard vclA"
varnish v1 -vcl+backend { }
varnish v1 -cliok "vcl.discard vcl3"
varnish v1 -cliok "vcl.discard vcl4"
varnish v1 -cliok "vcl.discard vcl5"
varnish v1 -cliok "vcl.discard vcl6"
varnish v1 -cliok "vcl.discard vcl7"
varnish v1 -cliok "vcl.discard vclB"
varnish v1 -cliok "vcl.discard vcl2"
varnish v1 -cliok "vcl.discard vclA"
varnish v1 -cliok "vcl.discard vcl1"
lib/libvcc/generate.py
View file @
a4c8ffa4
...
...
@@ -85,7 +85,7 @@ returns = (
(
'recv'
,
"C"
,
(
'synth'
,
'pass'
,
'pipe'
,
'hash'
,
'purge'
,)
(
'synth'
,
'pass'
,
'pipe'
,
'hash'
,
'purge'
,
'vcl'
)
),
(
'pipe'
,
"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