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
b4d76fea
Commit
b4d76fea
authored
Jun 18, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move more of the VRT interface from 'sp' to 'req'
parent
30ecc418
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
39 deletions
+41
-39
cache_hash.c
bin/varnishd/cache/cache_hash.c
+6
-5
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+22
-22
hash_slinger.h
bin/varnishd/hash/hash_slinger.h
+2
-1
vrt.h
include/vrt.h
+6
-6
vcc_action.c
lib/libvcl/vcc_action.c
+3
-3
vcc_var.c
lib/libvcl/vcc_var.c
+2
-2
No files found.
bin/varnishd/cache/cache_hash.c
View file @
b4d76fea
...
...
@@ -156,20 +156,21 @@ HSH_DeleteObjHead(struct dstat *ds, struct objhead *oh)
}
void
HSH_AddString
(
const
struct
sess
*
sp
,
const
char
*
str
)
HSH_AddString
(
struct
req
*
req
,
const
char
*
str
)
{
int
l
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
if
(
str
==
NULL
)
str
=
""
;
l
=
strlen
(
str
);
AN
(
sp
->
req
->
sha256ctx
);
SHA256_Update
(
sp
->
req
->
sha256ctx
,
str
,
l
);
SHA256_Update
(
sp
->
req
->
sha256ctx
,
"#"
,
1
);
AN
(
req
->
sha256ctx
);
SHA256_Update
(
req
->
sha256ctx
,
str
,
l
);
SHA256_Update
(
req
->
sha256ctx
,
"#"
,
1
);
if
(
cache_param
->
log_hash
)
VSLb
(
sp
->
req
->
vsl
,
SLT_Hash
,
"%s"
,
str
);
VSLb
(
req
->
vsl
,
SLT_Hash
,
"%s"
,
str
);
}
/*---------------------------------------------------------------------
...
...
bin/varnishd/cache/cache_vrt.c
View file @
b4d76fea
...
...
@@ -93,27 +93,27 @@ VRT_acl_log(const struct sess *sp, const char *msg)
/*--------------------------------------------------------------------*/
static
struct
http
*
vrt_selecthttp
(
const
struct
sess
*
sp
,
enum
gethdr_e
where
)
vrt_selecthttp
(
const
struct
req
*
req
,
enum
gethdr_e
where
)
{
struct
http
*
hp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
switch
(
where
)
{
case
HDR_REQ
:
hp
=
sp
->
req
->
http
;
hp
=
req
->
http
;
break
;
case
HDR_BEREQ
:
hp
=
sp
->
req
->
busyobj
->
bereq
;
hp
=
req
->
busyobj
->
bereq
;
break
;
case
HDR_BERESP
:
hp
=
sp
->
req
->
busyobj
->
beresp
;
hp
=
req
->
busyobj
->
beresp
;
break
;
case
HDR_RESP
:
hp
=
sp
->
req
->
resp
;
hp
=
req
->
resp
;
break
;
case
HDR_OBJ
:
CHECK_OBJ_NOTNULL
(
sp
->
req
->
obj
,
OBJECT_MAGIC
);
hp
=
sp
->
req
->
obj
->
http
;
CHECK_OBJ_NOTNULL
(
req
->
obj
,
OBJECT_MAGIC
);
hp
=
req
->
obj
->
http
;
break
;
default:
INCOMPL
();
...
...
@@ -123,13 +123,13 @@ vrt_selecthttp(const struct sess *sp, enum gethdr_e where)
}
char
*
VRT_GetHdr
(
const
struct
sess
*
sp
,
enum
gethdr_e
where
,
const
char
*
n
)
VRT_GetHdr
(
const
struct
req
*
req
,
enum
gethdr_e
where
,
const
char
*
n
)
{
char
*
p
;
struct
http
*
hp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
hp
=
vrt_selecthttp
(
sp
,
where
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
hp
=
vrt_selecthttp
(
req
,
where
);
if
(
!
http_GetHdr
(
hp
,
n
,
&
p
))
return
(
NULL
);
return
(
p
);
...
...
@@ -215,22 +215,22 @@ VRT_WrkString(const struct sess *sp, const char *p, ...)
/*--------------------------------------------------------------------*/
void
VRT_SetHdr
(
const
struct
sess
*
sp
,
enum
gethdr_e
where
,
const
char
*
hdr
,
VRT_SetHdr
(
struct
req
*
req
,
enum
gethdr_e
where
,
const
char
*
hdr
,
const
char
*
p
,
...)
{
struct
http
*
hp
;
va_list
ap
;
char
*
b
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
hp
=
vrt_selecthttp
(
sp
,
where
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
hp
=
vrt_selecthttp
(
req
,
where
);
va_start
(
ap
,
p
);
if
(
p
==
NULL
)
{
http_Unset
(
hp
,
hdr
);
}
else
{
b
=
VRT_String
(
hp
->
ws
,
hdr
+
1
,
p
,
ap
);
if
(
b
==
NULL
)
{
VSLb
(
sp
->
req
->
vsl
,
SLT_LostHeader
,
"%s"
,
hdr
+
1
);
VSLb
(
req
->
vsl
,
SLT_LostHeader
,
"%s"
,
hdr
+
1
);
}
else
{
http_Unset
(
hp
,
hdr
);
http_SetHeader
(
hp
,
b
);
...
...
@@ -242,16 +242,16 @@ VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr,
/*--------------------------------------------------------------------*/
void
VRT_handling
(
const
struct
sess
*
sp
,
unsigned
hand
)
VRT_handling
(
struct
req
*
req
,
unsigned
hand
)
{
if
(
sp
==
NULL
)
{
if
(
req
==
NULL
)
{
assert
(
hand
==
VCL_RET_OK
);
return
;
}
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
assert
(
hand
<
VCL_RET_MAX
);
sp
->
req
->
handling
=
hand
;
req
->
handling
=
hand
;
}
/*--------------------------------------------------------------------
...
...
@@ -259,18 +259,18 @@ VRT_handling(const struct sess *sp, unsigned hand)
*/
void
VRT_hashdata
(
const
struct
sess
*
sp
,
const
char
*
str
,
...)
VRT_hashdata
(
struct
req
*
req
,
const
char
*
str
,
...)
{
va_list
ap
;
const
char
*
p
;
HSH_AddString
(
sp
,
str
);
HSH_AddString
(
req
,
str
);
va_start
(
ap
,
str
);
while
(
1
)
{
p
=
va_arg
(
ap
,
const
char
*
);
if
(
p
==
vrt_magic_string_end
)
break
;
HSH_AddString
(
sp
,
p
);
HSH_AddString
(
req
,
p
);
}
}
...
...
bin/varnishd/hash/hash_slinger.h
View file @
b4d76fea
...
...
@@ -29,6 +29,7 @@
*/
struct
sess
;
struct
req
;
struct
worker
;
struct
object
;
...
...
@@ -56,7 +57,7 @@ struct objcore *HSH_Lookup(struct sess *sp);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_Drop
(
struct
worker
*
,
struct
object
**
);
void
HSH_Init
(
const
struct
hash_slinger
*
slinger
);
void
HSH_AddString
(
const
struct
sess
*
sp
,
const
char
*
str
);
void
HSH_AddString
(
struct
req
*
,
const
char
*
str
);
void
HSH_Insert
(
struct
worker
*
,
const
void
*
hash
,
struct
objcore
*
);
void
HSH_Purge
(
const
struct
sess
*
,
struct
objhead
*
,
double
ttl
,
double
grace
);
void
HSH_config
(
const
char
*
h_arg
);
...
...
include/vrt.h
View file @
b4d76fea
...
...
@@ -161,12 +161,12 @@ void VRT_error(const struct sess *, unsigned, const char *);
int
VRT_switch_config
(
const
char
*
);
enum
gethdr_e
{
HDR_REQ
,
HDR_RESP
,
HDR_OBJ
,
HDR_BEREQ
,
HDR_BERESP
};
char
*
VRT_GetHdr
(
const
struct
sess
*
,
enum
gethdr_e
where
,
const
char
*
);
void
VRT_SetHdr
(
const
struct
sess
*
,
enum
gethdr_e
where
,
const
char
*
,
char
*
VRT_GetHdr
(
const
struct
req
*
,
enum
gethdr_e
where
,
const
char
*
);
void
VRT_SetHdr
(
struct
req
*
,
enum
gethdr_e
where
,
const
char
*
,
const
char
*
,
...);
void
VRT_handling
(
const
struct
sess
*
sp
,
unsigned
hand
);
void
VRT_handling
(
struct
req
*
,
unsigned
hand
);
void
VRT_hashdata
(
const
struct
sess
*
sp
,
const
char
*
str
,
...);
void
VRT_hashdata
(
struct
req
*
,
const
char
*
str
,
...);
/* Simple stuff */
int
VRT_strcmp
(
const
char
*
s1
,
const
char
*
s2
);
...
...
@@ -217,9 +217,9 @@ char *VRT_time_string(const struct sess *sp, double);
const
char
*
VRT_bool_string
(
const
struct
sess
*
sp
,
unsigned
);
const
char
*
VRT_backend_string
(
const
struct
sess
*
sp
,
const
struct
director
*
d
);
#define VRT_done(
sp
, hand) \
#define VRT_done(
req
, hand) \
do { \
VRT_handling(
sp, hand);
\
VRT_handling(
req, hand);
\
return (1); \
} while (0)
...
...
lib/libvcl/vcc_action.c
View file @
b4d76fea
...
...
@@ -77,7 +77,7 @@ parse_error(struct vcc *tl)
Fb
(
tl
,
1
,
", 0
\n
"
);
}
Fb
(
tl
,
1
,
");
\n
"
);
Fb
(
tl
,
1
,
"VRT_done(
sp
, VCL_RET_ERROR);
\n
"
);
Fb
(
tl
,
1
,
"VRT_done(
req
, VCL_RET_ERROR);
\n
"
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -224,7 +224,7 @@ parse_hash_data(struct vcc *tl)
vcc_NextToken
(
tl
);
SkipToken
(
tl
,
'('
);
Fb
(
tl
,
1
,
"VRT_hashdata(
sp
, "
);
Fb
(
tl
,
1
,
"VRT_hashdata(
req
, "
);
vcc_Expr
(
tl
,
STRING_LIST
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
");
\n
"
);
...
...
@@ -259,7 +259,7 @@ parse_return(struct vcc *tl)
#define VCL_RET_MAC(l, U, B) \
do { \
if (vcc_IdIs(tl->t, #l)) { \
Fb(tl, 1, "VRT_done(
sp
, VCL_RET_" #U ");\n"); \
Fb(tl, 1, "VRT_done(
req
, VCL_RET_" #U ");\n"); \
vcc_ProcAction(tl->curproc, VCL_RET_##U, tl->t);\
retval = 1; \
} \
...
...
lib/libvcl/vcc_var.c
View file @
b4d76fea
...
...
@@ -59,10 +59,10 @@ vcc_Var_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wc)
bprintf
(
buf
,
"
\\
%03o%s:"
,
(
unsigned
)
l
,
v
->
name
+
vh
->
len
);
v
->
hdr
=
TlDup
(
tl
,
buf
);
bprintf
(
buf
,
"VRT_GetHdr(
sp
, %s,
\"
%s
\"
)"
,
v
->
http
,
v
->
hdr
);
bprintf
(
buf
,
"VRT_GetHdr(
req
, %s,
\"
%s
\"
)"
,
v
->
http
,
v
->
hdr
);
v
->
rname
=
TlDup
(
tl
,
buf
);
bprintf
(
buf
,
"VRT_SetHdr(
sp
, %s,
\"
%s
\"
, "
,
v
->
http
,
v
->
hdr
);
bprintf
(
buf
,
"VRT_SetHdr(
req
, %s,
\"
%s
\"
, "
,
v
->
http
,
v
->
hdr
);
v
->
lname
=
TlDup
(
tl
,
buf
);
sym
=
VCC_AddSymbolTok
(
tl
,
t
,
SYM_VAR
);
...
...
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