Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
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
Hide 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)
...
@@ -156,20 +156,21 @@ HSH_DeleteObjHead(struct dstat *ds, struct objhead *oh)
}
}
void
void
HSH_AddString
(
const
struct
sess
*
sp
,
const
char
*
str
)
HSH_AddString
(
struct
req
*
req
,
const
char
*
str
)
{
{
int
l
;
int
l
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
if
(
str
==
NULL
)
if
(
str
==
NULL
)
str
=
""
;
str
=
""
;
l
=
strlen
(
str
);
l
=
strlen
(
str
);
AN
(
sp
->
req
->
sha256ctx
);
AN
(
req
->
sha256ctx
);
SHA256_Update
(
sp
->
req
->
sha256ctx
,
str
,
l
);
SHA256_Update
(
req
->
sha256ctx
,
str
,
l
);
SHA256_Update
(
sp
->
req
->
sha256ctx
,
"#"
,
1
);
SHA256_Update
(
req
->
sha256ctx
,
"#"
,
1
);
if
(
cache_param
->
log_hash
)
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)
...
@@ -93,27 +93,27 @@ VRT_acl_log(const struct sess *sp, const char *msg)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
struct
http
*
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
;
struct
http
*
hp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
switch
(
where
)
{
switch
(
where
)
{
case
HDR_REQ
:
case
HDR_REQ
:
hp
=
sp
->
req
->
http
;
hp
=
req
->
http
;
break
;
break
;
case
HDR_BEREQ
:
case
HDR_BEREQ
:
hp
=
sp
->
req
->
busyobj
->
bereq
;
hp
=
req
->
busyobj
->
bereq
;
break
;
break
;
case
HDR_BERESP
:
case
HDR_BERESP
:
hp
=
sp
->
req
->
busyobj
->
beresp
;
hp
=
req
->
busyobj
->
beresp
;
break
;
break
;
case
HDR_RESP
:
case
HDR_RESP
:
hp
=
sp
->
req
->
resp
;
hp
=
req
->
resp
;
break
;
break
;
case
HDR_OBJ
:
case
HDR_OBJ
:
CHECK_OBJ_NOTNULL
(
sp
->
req
->
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
->
obj
,
OBJECT_MAGIC
);
hp
=
sp
->
req
->
obj
->
http
;
hp
=
req
->
obj
->
http
;
break
;
break
;
default:
default:
INCOMPL
();
INCOMPL
();
...
@@ -123,13 +123,13 @@ vrt_selecthttp(const struct sess *sp, enum gethdr_e where)
...
@@ -123,13 +123,13 @@ vrt_selecthttp(const struct sess *sp, enum gethdr_e where)
}
}
char
*
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
;
char
*
p
;
struct
http
*
hp
;
struct
http
*
hp
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
hp
=
vrt_selecthttp
(
sp
,
where
);
hp
=
vrt_selecthttp
(
req
,
where
);
if
(
!
http_GetHdr
(
hp
,
n
,
&
p
))
if
(
!
http_GetHdr
(
hp
,
n
,
&
p
))
return
(
NULL
);
return
(
NULL
);
return
(
p
);
return
(
p
);
...
@@ -215,22 +215,22 @@ VRT_WrkString(const struct sess *sp, const char *p, ...)
...
@@ -215,22 +215,22 @@ VRT_WrkString(const struct sess *sp, const char *p, ...)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
void
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
,
...)
const
char
*
p
,
...)
{
{
struct
http
*
hp
;
struct
http
*
hp
;
va_list
ap
;
va_list
ap
;
char
*
b
;
char
*
b
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
hp
=
vrt_selecthttp
(
sp
,
where
);
hp
=
vrt_selecthttp
(
req
,
where
);
va_start
(
ap
,
p
);
va_start
(
ap
,
p
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
http_Unset
(
hp
,
hdr
);
http_Unset
(
hp
,
hdr
);
}
else
{
}
else
{
b
=
VRT_String
(
hp
->
ws
,
hdr
+
1
,
p
,
ap
);
b
=
VRT_String
(
hp
->
ws
,
hdr
+
1
,
p
,
ap
);
if
(
b
==
NULL
)
{
if
(
b
==
NULL
)
{
VSLb
(
sp
->
req
->
vsl
,
SLT_LostHeader
,
"%s"
,
hdr
+
1
);
VSLb
(
req
->
vsl
,
SLT_LostHeader
,
"%s"
,
hdr
+
1
);
}
else
{
}
else
{
http_Unset
(
hp
,
hdr
);
http_Unset
(
hp
,
hdr
);
http_SetHeader
(
hp
,
b
);
http_SetHeader
(
hp
,
b
);
...
@@ -242,16 +242,16 @@ VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr,
...
@@ -242,16 +242,16 @@ VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr,
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
void
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
);
assert
(
hand
==
VCL_RET_OK
);
return
;
return
;
}
}
CHECK_OBJ_NOTNULL
(
sp
,
SESS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
assert
(
hand
<
VCL_RET_MAX
);
assert
(
hand
<
VCL_RET_MAX
);
sp
->
req
->
handling
=
hand
;
req
->
handling
=
hand
;
}
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
...
@@ -259,18 +259,18 @@ VRT_handling(const struct sess *sp, unsigned hand)
...
@@ -259,18 +259,18 @@ VRT_handling(const struct sess *sp, unsigned hand)
*/
*/
void
void
VRT_hashdata
(
const
struct
sess
*
sp
,
const
char
*
str
,
...)
VRT_hashdata
(
struct
req
*
req
,
const
char
*
str
,
...)
{
{
va_list
ap
;
va_list
ap
;
const
char
*
p
;
const
char
*
p
;
HSH_AddString
(
sp
,
str
);
HSH_AddString
(
req
,
str
);
va_start
(
ap
,
str
);
va_start
(
ap
,
str
);
while
(
1
)
{
while
(
1
)
{
p
=
va_arg
(
ap
,
const
char
*
);
p
=
va_arg
(
ap
,
const
char
*
);
if
(
p
==
vrt_magic_string_end
)
if
(
p
==
vrt_magic_string_end
)
break
;
break
;
HSH_AddString
(
sp
,
p
);
HSH_AddString
(
req
,
p
);
}
}
}
}
...
...
bin/varnishd/hash/hash_slinger.h
View file @
b4d76fea
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
*/
*/
struct
sess
;
struct
sess
;
struct
req
;
struct
worker
;
struct
worker
;
struct
object
;
struct
object
;
...
@@ -56,7 +57,7 @@ struct objcore *HSH_Lookup(struct sess *sp);
...
@@ -56,7 +57,7 @@ struct objcore *HSH_Lookup(struct sess *sp);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_Ref
(
struct
objcore
*
o
);
void
HSH_Drop
(
struct
worker
*
,
struct
object
**
);
void
HSH_Drop
(
struct
worker
*
,
struct
object
**
);
void
HSH_Init
(
const
struct
hash_slinger
*
slinger
);
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_Insert
(
struct
worker
*
,
const
void
*
hash
,
struct
objcore
*
);
void
HSH_Purge
(
const
struct
sess
*
,
struct
objhead
*
,
double
ttl
,
double
grace
);
void
HSH_Purge
(
const
struct
sess
*
,
struct
objhead
*
,
double
ttl
,
double
grace
);
void
HSH_config
(
const
char
*
h_arg
);
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 *);
...
@@ -161,12 +161,12 @@ void VRT_error(const struct sess *, unsigned, const char *);
int
VRT_switch_config
(
const
char
*
);
int
VRT_switch_config
(
const
char
*
);
enum
gethdr_e
{
HDR_REQ
,
HDR_RESP
,
HDR_OBJ
,
HDR_BEREQ
,
HDR_BERESP
};
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
*
);
char
*
VRT_GetHdr
(
const
struct
req
*
,
enum
gethdr_e
where
,
const
char
*
);
void
VRT_SetHdr
(
const
struct
sess
*
,
enum
gethdr_e
where
,
const
char
*
,
void
VRT_SetHdr
(
struct
req
*
,
enum
gethdr_e
where
,
const
char
*
,
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 */
/* Simple stuff */
int
VRT_strcmp
(
const
char
*
s1
,
const
char
*
s2
);
int
VRT_strcmp
(
const
char
*
s1
,
const
char
*
s2
);
...
@@ -217,9 +217,9 @@ char *VRT_time_string(const struct sess *sp, double);
...
@@ -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_bool_string
(
const
struct
sess
*
sp
,
unsigned
);
const
char
*
VRT_backend_string
(
const
struct
sess
*
sp
,
const
struct
director
*
d
);
const
char
*
VRT_backend_string
(
const
struct
sess
*
sp
,
const
struct
director
*
d
);
#define VRT_done(
sp
, hand) \
#define VRT_done(
req
, hand) \
do { \
do { \
VRT_handling(
sp, hand);
\
VRT_handling(
req, hand);
\
return (1); \
return (1); \
} while (0)
} while (0)
...
...
lib/libvcl/vcc_action.c
View file @
b4d76fea
...
@@ -77,7 +77,7 @@ parse_error(struct vcc *tl)
...
@@ -77,7 +77,7 @@ parse_error(struct vcc *tl)
Fb
(
tl
,
1
,
", 0
\n
"
);
Fb
(
tl
,
1
,
", 0
\n
"
);
}
}
Fb
(
tl
,
1
,
");
\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)
...
@@ -224,7 +224,7 @@ parse_hash_data(struct vcc *tl)
vcc_NextToken
(
tl
);
vcc_NextToken
(
tl
);
SkipToken
(
tl
,
'('
);
SkipToken
(
tl
,
'('
);
Fb
(
tl
,
1
,
"VRT_hashdata(
sp
, "
);
Fb
(
tl
,
1
,
"VRT_hashdata(
req
, "
);
vcc_Expr
(
tl
,
STRING_LIST
);
vcc_Expr
(
tl
,
STRING_LIST
);
ERRCHK
(
tl
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
");
\n
"
);
Fb
(
tl
,
0
,
");
\n
"
);
...
@@ -259,7 +259,7 @@ parse_return(struct vcc *tl)
...
@@ -259,7 +259,7 @@ parse_return(struct vcc *tl)
#define VCL_RET_MAC(l, U, B) \
#define VCL_RET_MAC(l, U, B) \
do { \
do { \
if (vcc_IdIs(tl->t, #l)) { \
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);\
vcc_ProcAction(tl->curproc, VCL_RET_##U, tl->t);\
retval = 1; \
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)
...
@@ -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
);
bprintf
(
buf
,
"
\\
%03o%s:"
,
(
unsigned
)
l
,
v
->
name
+
vh
->
len
);
v
->
hdr
=
TlDup
(
tl
,
buf
);
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
);
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
);
v
->
lname
=
TlDup
(
tl
,
buf
);
sym
=
VCC_AddSymbolTok
(
tl
,
t
,
SYM_VAR
);
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