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
69f498d4
Commit
69f498d4
authored
Apr 16, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass the designated workspace to the VCL methods.
parent
b7027d48
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
18 deletions
+21
-18
cache.h
bin/varnishd/cache/cache.h
+2
-1
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+11
-11
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+4
-4
generate.py
lib/libvcl/generate.py
+2
-1
vcc_compile.c
lib/libvcl/vcc_compile.c
+2
-1
No files found.
bin/varnishd/cache/cache.h
View file @
69f498d4
...
...
@@ -1016,7 +1016,8 @@ void VCL_Rel(struct VCL_conf **vcc);
void
VCL_Poll
(
void
);
const
char
*
VCL_Return_Name
(
unsigned
method
);
#define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct worker *, struct req *);
#define VCL_MET_MAC(l,u,b) \
void VCL_##l##_method(struct worker *, struct req *, struct ws *);
#include "tbl/vcl_returns.h"
#undef VCL_MET_MAC
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
69f498d4
...
...
@@ -158,7 +158,7 @@ cnt_prepresp(struct worker *wrk, struct req *req)
HTTP_Setup
(
req
->
resp
,
req
->
ws
,
req
->
vsl
,
HTTP_Resp
);
RES_BuildHttp
(
req
);
VCL_deliver_method
(
wrk
,
req
);
VCL_deliver_method
(
wrk
,
req
,
req
->
http
->
ws
);
switch
(
req
->
handling
)
{
case
VCL_RET_DELIVER
:
break
;
...
...
@@ -308,7 +308,7 @@ cnt_error(struct worker *wrk, struct req *req)
http_PutResponse
(
h
,
req
->
err_reason
);
else
http_PutResponse
(
h
,
http_StatusMessage
(
req
->
err_code
));
VCL_error_method
(
wrk
,
req
);
VCL_error_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_RESTART
&&
req
->
restarts
<
cache_param
->
max_restarts
)
{
...
...
@@ -416,7 +416,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
AZ
(
bo
->
do_esi
);
AZ
(
bo
->
do_pass
);
VCL_response_method
(
wrk
,
req
);
VCL_response_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
bo
->
do_pass
)
req
->
objcore
->
flags
|=
OC_F_PASS
;
...
...
@@ -845,7 +845,7 @@ VSLb(req->vsl, SLT_Debug, "XXXX HIT\n");
AZ
(
req
->
objcore
);
AZ
(
req
->
busyobj
);
VCL_lookup_method
(
wrk
,
req
);
VCL_lookup_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
((
req
->
obj
->
objcore
->
flags
&
OC_F_PASS
)
&&
req
->
handling
==
VCL_RET_DELIVER
)
{
...
...
@@ -923,8 +923,8 @@ cnt_miss(struct worker *wrk, struct req *req)
http_SetHeader
(
bo
->
bereq
,
"Accept-Encoding: gzip"
);
}
VCL_fetch_method
(
wrk
,
req
);
VCL_miss_method
(
wrk
,
req
);
VCL_fetch_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_miss_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_FETCH
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
...
...
@@ -988,8 +988,8 @@ cnt_pass(struct worker *wrk, struct req *req)
HTTP_Setup
(
bo
->
bereq
,
bo
->
ws
,
bo
->
vsl
,
HTTP_Bereq
);
http_FilterReq
(
req
,
HTTPH_R_PASS
);
VCL_fetch_method
(
wrk
,
req
);
VCL_pass_method
(
wrk
,
req
);
VCL_fetch_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_pass_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_ERROR
)
{
http_Teardown
(
bo
->
bereq
);
...
...
@@ -1047,7 +1047,7 @@ cnt_pipe(struct worker *wrk, struct req *req)
HTTP_Setup
(
bo
->
bereq
,
bo
->
ws
,
bo
->
vsl
,
HTTP_Bereq
);
http_FilterReq
(
req
,
0
);
VCL_pipe_method
(
wrk
,
req
);
VCL_pipe_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_ERROR
)
INCOMPL
();
...
...
@@ -1153,7 +1153,7 @@ cnt_recv(struct worker *wrk, struct req *req)
http_CollectHdr
(
req
->
http
,
H_Cache_Control
);
VCL_recv_method
(
wrk
,
req
);
VCL_recv_method
(
wrk
,
req
,
req
->
http
->
ws
);
recv_handling
=
req
->
handling
;
if
(
cache_param
->
http_gzip_support
&&
...
...
@@ -1169,7 +1169,7 @@ cnt_recv(struct worker *wrk, struct req *req)
req
->
sha256ctx
=
&
sha256ctx
;
/* so HSH_AddString() can find it */
SHA256_Init
(
req
->
sha256ctx
);
VCL_hash_method
(
wrk
,
req
);
VCL_hash_method
(
wrk
,
req
,
req
->
http
->
ws
);
assert
(
req
->
handling
==
VCL_RET_HASH
);
SHA256_Final
(
req
->
digest
,
req
->
sha256ctx
);
req
->
sha256ctx
=
NULL
;
...
...
bin/varnishd/cache/cache_vcl.c
View file @
69f498d4
...
...
@@ -191,7 +191,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
REPLACE
(
vcl
->
name
,
name
);
VCLI_Out
(
cli
,
"Loaded
\"
%s
\"
as
\"
%s
\"
"
,
fn
,
name
);
VTAILQ_INSERT_TAIL
(
&
vcl_head
,
vcl
,
list
);
(
void
)
vcl
->
conf
->
init_func
(
NULL
,
NULL
);
(
void
)
vcl
->
conf
->
init_func
(
NULL
,
NULL
,
NULL
);
Lck_Lock
(
&
vcl_mtx
);
if
(
vcl_active
==
NULL
)
vcl_active
=
vcl
;
...
...
@@ -215,7 +215,7 @@ VCL_Nuke(struct vcls *vcl)
assert
(
vcl
->
conf
->
discard
);
assert
(
vcl
->
conf
->
busy
==
0
);
VTAILQ_REMOVE
(
&
vcl_head
,
vcl
,
list
);
(
void
)
vcl
->
conf
->
fini_func
(
NULL
,
NULL
);
(
void
)
vcl
->
conf
->
fini_func
(
NULL
,
NULL
,
NULL
);
vcl
->
conf
->
fini_vcl
(
NULL
);
free
(
vcl
->
name
);
(
void
)
dlclose
(
vcl
->
dlh
);
...
...
@@ -336,7 +336,7 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv)
#define VCL_MET_MAC(func, upper, bitmap) \
void \
VCL_##func##_method(struct worker *wrk, struct req *req
)
\
VCL_##func##_method(struct worker *wrk, struct req *req
, struct ws *ws)
\
{ \
char *aws; \
\
...
...
@@ -347,7 +347,7 @@ VCL_##func##_method(struct worker *wrk, struct req *req) \
req->handling = 0; \
req->cur_method = VCL_MET_ ## upper; \
VSLb(req->vsl, SLT_VCL_call, "%s", #func); \
(void)req->vcl->func##_func(wrk, req
);
\
(void)req->vcl->func##_func(wrk, req
, ws);
\
VSLb(req->vsl, SLT_VCL_return, "%s", \
VCL_Return_Name(req->handling)); \
req->cur_method = 0; \
...
...
lib/libvcl/generate.py
View file @
69f498d4
...
...
@@ -745,12 +745,13 @@ file_header(fo)
fo
.
write
(
"""
struct sess;
struct req;
struct ws;
struct cli;
struct worker;
typedef int vcl_init_f(struct cli *);
typedef void vcl_fini_f(struct cli *);
typedef int vcl_func_f(struct worker *
wrk, struct req *req
);
typedef int vcl_func_f(struct worker *
, struct req *, struct ws *
);
"""
)
...
...
lib/libvcl/vcc_compile.c
View file @
69f498d4
...
...
@@ -693,7 +693,8 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
for
(
i
=
0
;
i
<
VCL_MET_MAX
;
i
++
)
{
Fc
(
tl
,
1
,
"
\n
static int __match_proto__(vcl_func_f)
\n
"
);
Fc
(
tl
,
1
,
"VGC_function_%s(struct worker *wrk, struct req *req)
\n
"
,
"VGC_function_%s(struct worker *wrk,"
" struct req *req, struct ws *ws)
\n
"
,
method_tab
[
i
].
name
);
AZ
(
VSB_finish
(
tl
->
fm
[
i
]));
Fc
(
tl
,
1
,
"{
\n
"
);
...
...
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