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
c395b650
Commit
c395b650
authored
Apr 22, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add even more arguments to the VCL method functions
parent
0c223ef0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
22 deletions
+33
-22
cache.h
bin/varnishd/cache/cache.h
+2
-1
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+12
-11
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+19
-10
No files found.
bin/varnishd/cache/cache.h
View file @
c395b650
...
...
@@ -1019,7 +1019,8 @@ const char *VCL_Return_Name(unsigned);
const
char
*
VCL_Method_Name
(
unsigned
);
#define VCL_MET_MAC(l,u,b) \
void VCL_##l##_method(struct worker *, struct req *, struct ws *);
void VCL_##l##_method(struct VCL_conf *, struct worker *, struct req *, \
struct busyobj *bo, struct ws *);
#include "tbl/vcl_returns.h"
#undef VCL_MET_MAC
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
c395b650
...
...
@@ -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
,
req
->
http
->
ws
);
VCL_deliver_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
switch
(
wrk
->
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
,
req
->
http
->
ws
);
VCL_error_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
(
wrk
->
handling
==
VCL_RET_RESTART
&&
req
->
restarts
<
cache_param
->
max_restarts
)
{
...
...
@@ -416,7 +416,8 @@ cnt_fetch(struct worker *wrk, struct req *req)
AZ
(
bo
->
do_esi
);
AZ
(
bo
->
do_pass
);
VCL_backend_response_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_backend_response_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
(
bo
->
do_pass
)
req
->
objcore
->
flags
|=
OC_F_PASS
;
...
...
@@ -845,7 +846,7 @@ VSLb(req->vsl, SLT_Debug, "XXXX HIT\n");
AZ
(
req
->
objcore
);
AZ
(
req
->
busyobj
);
VCL_lookup_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_lookup_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
((
req
->
obj
->
objcore
->
flags
&
OC_F_PASS
)
&&
wrk
->
handling
==
VCL_RET_DELIVER
)
{
...
...
@@ -923,8 +924,8 @@ cnt_miss(struct worker *wrk, struct req *req)
http_SetHeader
(
bo
->
bereq
,
"Accept-Encoding: gzip"
);
}
VCL_backend_fetch_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_miss_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_backend_fetch_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
VCL_miss_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
(
wrk
->
handling
==
VCL_RET_FETCH
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
...
...
@@ -988,8 +989,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_backend_fetch_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_pass_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_backend_fetch_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
VCL_pass_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
(
wrk
->
handling
==
VCL_RET_ERROR
)
{
http_Teardown
(
bo
->
bereq
);
...
...
@@ -1047,7 +1048,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
,
req
->
http
->
ws
);
VCL_pipe_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
if
(
wrk
->
handling
==
VCL_RET_ERROR
)
INCOMPL
();
...
...
@@ -1153,7 +1154,7 @@ cnt_recv(struct worker *wrk, struct req *req)
http_CollectHdr
(
req
->
http
,
H_Cache_Control
);
VCL_recv_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_recv_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
recv_handling
=
wrk
->
handling
;
if
(
cache_param
->
http_gzip_support
&&
...
...
@@ -1169,7 +1170,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
,
req
->
http
->
ws
);
VCL_hash_method
(
req
->
vcl
,
wrk
,
req
,
NULL
,
req
->
http
->
ws
);
assert
(
wrk
->
handling
==
VCL_RET_HASH
);
SHA256_Final
(
req
->
digest
,
req
->
sha256ctx
);
req
->
sha256ctx
=
NULL
;
...
...
bin/varnishd/cache/cache_vcl.c
View file @
c395b650
...
...
@@ -358,33 +358,42 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv)
/*--------------------------------------------------------------------*/
static
void
vcl_call_method
(
struct
worker
*
wrk
,
struct
req
*
req
,
struct
ws
*
ws
,
unsigned
method
,
vcl_func_f
*
func
)
vcl_call_method
(
struct
worker
*
wrk
,
struct
req
*
req
,
struct
busyobj
*
bo
,
struct
ws
*
ws
,
unsigned
method
,
vcl_func_f
*
func
)
{
char
*
aws
;
struct
vsl_log
*
vsl
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
sp
,
SESS_MAGIC
);
AN
(
req
->
sp
);
if
(
req
!=
NULL
)
{
AZ
(
bo
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
sp
,
SESS_MAGIC
);
vsl
=
req
->
vsl
;
}
else
{
AZ
(
req
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
vsl
=
bo
->
vsl
;
}
aws
=
WS_Snapshot
(
wrk
->
aws
);
wrk
->
handling
=
0
;
wrk
->
cur_method
=
method
;
VSLb
(
req
->
vsl
,
SLT_VCL_call
,
"%s"
,
VCL_Method_Name
(
method
));
VSLb
(
vsl
,
SLT_VCL_call
,
"%s"
,
VCL_Method_Name
(
method
));
(
void
)
func
(
wrk
,
req
,
NULL
,
ws
);
VSLb
(
req
->
vsl
,
SLT_VCL_return
,
"%s"
,
VCL_Return_Name
(
wrk
->
handling
));
VSLb
(
vsl
,
SLT_VCL_return
,
"%s"
,
VCL_Return_Name
(
wrk
->
handling
));
wrk
->
cur_method
=
0
;
WS_Reset
(
wrk
->
aws
,
aws
);
}
#define VCL_MET_MAC(func, upper, bitmap) \
void \
VCL_##func##_method(struct worker *wrk, struct req *req, struct ws *ws) \
VCL_##func##_method(struct VCL_conf *vcl, struct worker *wrk, \
struct req *req, struct busyobj *bo, struct ws *ws) \
{ \
\
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); \
vcl_call_method(wrk, req, ws, VCL_MET_ ## upper, \
req->vcl->func##_func);
\
vcl_call_method(wrk, req,
bo,
ws, VCL_MET_ ## upper, \
vcl->func##_func);
\
assert((1U << wrk->handling) & bitmap); \
assert(!((1U << wrk->handling) & ~bitmap)); \
}
...
...
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