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
acab05e0
Commit
acab05e0
authored
Jun 18, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More VRT sp->req movements
parent
56ce6e35
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
29 deletions
+31
-29
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+5
-4
cache_vrt_re.c
bin/varnishd/cache/cache_vrt_re.c
+12
-12
vrt.h
include/vrt.h
+4
-4
vcc_acl.c
lib/libvcl/vcc_acl.c
+5
-5
vcc_action.c
lib/libvcl/vcc_action.c
+1
-1
vcc_expr.c
lib/libvcl/vcc_expr.c
+4
-3
No files found.
bin/varnishd/cache/cache_vrt.c
View file @
acab05e0
...
@@ -83,10 +83,10 @@ VRT_count(struct req *req, unsigned u)
...
@@ -83,10 +83,10 @@ VRT_count(struct req *req, unsigned u)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
void
void
VRT_acl_log
(
const
struct
sess
*
sp
,
const
char
*
msg
)
VRT_acl_log
(
struct
req
*
req
,
const
char
*
msg
)
{
{
VSLb
(
sp
->
req
->
vsl
,
SLT_VCL_acl
,
"%s"
,
msg
);
VSLb
(
req
->
vsl
,
SLT_VCL_acl
,
"%s"
,
msg
);
}
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
...
@@ -385,13 +385,14 @@ VRT_Rollback(const struct sess *sp)
...
@@ -385,13 +385,14 @@ VRT_Rollback(const struct sess *sp)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
void
void
VRT_panic
(
const
struct
sess
*
sp
,
const
char
*
str
,
...)
VRT_panic
(
struct
req
*
req
,
const
char
*
str
,
...)
{
{
va_list
ap
;
va_list
ap
;
char
*
b
;
char
*
b
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
va_start
(
ap
,
str
);
va_start
(
ap
,
str
);
b
=
VRT_String
(
sp
->
req
->
http
->
ws
,
"PANIC: "
,
str
,
ap
);
b
=
VRT_String
(
req
->
http
->
ws
,
"PANIC: "
,
str
,
ap
);
va_end
(
ap
);
va_end
(
ap
);
VAS_Fail
(
"VCL"
,
""
,
0
,
b
,
0
,
2
);
VAS_Fail
(
"VCL"
,
""
,
0
,
b
,
0
,
2
);
}
}
...
...
bin/varnishd/cache/cache_vrt_re.c
View file @
acab05e0
...
@@ -62,11 +62,12 @@ VRT_re_fini(void *rep)
...
@@ -62,11 +62,12 @@ VRT_re_fini(void *rep)
}
}
int
int
VRT_re_match
(
const
struct
sess
*
sp
,
const
char
*
s
,
void
*
re
)
VRT_re_match
(
struct
req
*
req
,
const
char
*
s
,
void
*
re
)
{
{
vre_t
*
t
;
vre_t
*
t
;
int
i
;
int
i
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
if
(
s
==
NULL
)
if
(
s
==
NULL
)
s
=
""
;
s
=
""
;
AN
(
re
);
AN
(
re
);
...
@@ -75,13 +76,12 @@ VRT_re_match(const struct sess *sp, const char *s, void *re)
...
@@ -75,13 +76,12 @@ VRT_re_match(const struct sess *sp, const char *s, void *re)
if
(
i
>=
0
)
if
(
i
>=
0
)
return
(
1
);
return
(
1
);
if
(
i
<
VRE_ERROR_NOMATCH
)
if
(
i
<
VRE_ERROR_NOMATCH
)
VSLb
(
sp
->
req
->
vsl
,
SLT_VCL_Error
,
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"Regexp matching returned %d"
,
i
);
"Regexp matching returned %d"
,
i
);
return
(
0
);
return
(
0
);
}
}
const
char
*
const
char
*
VRT_regsub
(
const
struct
sess
*
sp
,
int
all
,
const
char
*
str
,
void
*
re
,
VRT_regsub
(
struct
req
*
req
,
int
all
,
const
char
*
str
,
void
*
re
,
const
char
*
sub
)
const
char
*
sub
)
{
{
int
ovector
[
30
];
int
ovector
[
30
];
...
@@ -94,6 +94,7 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
...
@@ -94,6 +94,7 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
int
options
=
0
;
int
options
=
0
;
size_t
len
;
size_t
len
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
AN
(
re
);
AN
(
re
);
if
(
str
==
NULL
)
if
(
str
==
NULL
)
str
=
""
;
str
=
""
;
...
@@ -109,13 +110,12 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
...
@@ -109,13 +110,12 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
if
(
i
==
VRE_ERROR_NOMATCH
)
if
(
i
==
VRE_ERROR_NOMATCH
)
return
(
str
);
return
(
str
);
if
(
i
<
VRE_ERROR_NOMATCH
)
{
if
(
i
<
VRE_ERROR_NOMATCH
)
{
VSLb
(
sp
->
req
->
vsl
,
SLT_VCL_Error
,
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"Regexp matching returned %d"
,
i
);
"Regexp matching returned %d"
,
i
);
return
(
str
);
return
(
str
);
}
}
u
=
WS_Reserve
(
sp
->
req
->
http
->
ws
,
0
);
u
=
WS_Reserve
(
req
->
http
->
ws
,
0
);
res
.
e
=
res
.
b
=
b0
=
sp
->
req
->
http
->
ws
->
f
;
res
.
e
=
res
.
b
=
b0
=
req
->
http
->
ws
->
f
;
res
.
e
+=
u
;
res
.
e
+=
u
;
do
{
do
{
...
@@ -147,8 +147,8 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
...
@@ -147,8 +147,8 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
i
=
VRE_exec
(
t
,
str
,
len
,
0
,
options
,
ovector
,
30
,
i
=
VRE_exec
(
t
,
str
,
len
,
0
,
options
,
ovector
,
30
,
&
cache_param
->
vre_limits
);
&
cache_param
->
vre_limits
);
if
(
i
<
VRE_ERROR_NOMATCH
)
{
if
(
i
<
VRE_ERROR_NOMATCH
)
{
WS_Release
(
sp
->
req
->
http
->
ws
,
0
);
WS_Release
(
req
->
http
->
ws
,
0
);
VSLb
(
sp
->
req
->
vsl
,
SLT_VCL_Error
,
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"Regexp matching returned %d"
,
i
);
"Regexp matching returned %d"
,
i
);
return
(
str
);
return
(
str
);
}
}
...
@@ -157,10 +157,10 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
...
@@ -157,10 +157,10 @@ VRT_regsub(const struct sess *sp, int all, const char *str, void *re,
/* Copy suffix to match */
/* Copy suffix to match */
Tadd
(
&
res
,
str
,
len
+
1
);
Tadd
(
&
res
,
str
,
len
+
1
);
if
(
res
.
b
>=
res
.
e
)
{
if
(
res
.
b
>=
res
.
e
)
{
WS_Release
(
sp
->
req
->
http
->
ws
,
0
);
WS_Release
(
req
->
http
->
ws
,
0
);
return
(
str
);
return
(
str
);
}
}
Tcheck
(
res
);
Tcheck
(
res
);
WS_ReleaseP
(
sp
->
req
->
http
->
ws
,
res
.
b
);
WS_ReleaseP
(
req
->
http
->
ws
,
res
.
b
);
return
(
b0
);
return
(
b0
);
}
}
include/vrt.h
View file @
acab05e0
...
@@ -141,16 +141,16 @@ struct vrt_ref {
...
@@ -141,16 +141,16 @@ struct vrt_ref {
/* ACL related */
/* ACL related */
#define VRT_ACL_MAXADDR 16
/* max(IPv4, IPv6) */
#define VRT_ACL_MAXADDR 16
/* max(IPv4, IPv6) */
void
VRT_acl_log
(
const
struct
sess
*
,
const
char
*
msg
);
void
VRT_acl_log
(
struct
req
*
,
const
char
*
msg
);
/* Regexp related */
/* Regexp related */
void
VRT_re_init
(
void
**
,
const
char
*
);
void
VRT_re_init
(
void
**
,
const
char
*
);
void
VRT_re_fini
(
void
*
);
void
VRT_re_fini
(
void
*
);
int
VRT_re_match
(
const
struct
sess
*
sp
,
const
char
*
,
void
*
re
);
int
VRT_re_match
(
struct
req
*
,
const
char
*
,
void
*
re
);
const
char
*
VRT_regsub
(
const
struct
sess
*
sp
,
int
all
,
const
char
*
,
const
char
*
VRT_regsub
(
struct
req
*
,
int
all
,
const
char
*
,
void
*
,
const
char
*
);
void
*
,
const
char
*
);
void
VRT_panic
(
const
struct
sess
*
sp
,
const
char
*
,
...);
void
VRT_panic
(
struct
req
*
req
,
const
char
*
,
...);
void
VRT_ban
(
struct
sess
*
sp
,
char
*
,
...);
void
VRT_ban
(
struct
sess
*
sp
,
char
*
,
...);
void
VRT_ban_string
(
struct
sess
*
sp
,
const
char
*
);
void
VRT_ban_string
(
struct
sess
*
sp
,
const
char
*
);
void
VRT_purge
(
const
struct
sess
*
sp
,
double
ttl
,
double
grace
);
void
VRT_purge
(
const
struct
sess
*
sp
,
double
ttl
,
double
grace
);
...
...
lib/libvcl/vcc_acl.c
View file @
acab05e0
...
@@ -357,7 +357,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
...
@@ -357,7 +357,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
const
char
*
oc
;
const
char
*
oc
;
Fh
(
tl
,
0
,
"
\n
static int
\n
"
);
Fh
(
tl
,
0
,
"
\n
static int
\n
"
);
Fh
(
tl
,
0
,
"match_acl_%s_%s(
const struct sess *sp
, const void *p)
\n
"
,
Fh
(
tl
,
0
,
"match_acl_%s_%s(
struct req *req
, const void *p)
\n
"
,
anon
?
"anon"
:
"named"
,
acln
);
anon
?
"anon"
:
"named"
,
acln
);
Fh
(
tl
,
0
,
"{
\n
"
);
Fh
(
tl
,
0
,
"{
\n
"
);
Fh
(
tl
,
0
,
"
\t
const unsigned char *a;
\n
"
);
Fh
(
tl
,
0
,
"
\t
const unsigned char *a;
\n
"
);
...
@@ -372,7 +372,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
...
@@ -372,7 +372,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
Fh
(
tl
,
0
,
"
\t
else if (fam == %d)
\n
"
,
PF_INET6
);
Fh
(
tl
,
0
,
"
\t
else if (fam == %d)
\n
"
,
PF_INET6
);
Fh
(
tl
,
0
,
"
\t\t
a += %zd;
\n
"
,
offsetof
(
struct
sockaddr_in6
,
sin6_addr
));
Fh
(
tl
,
0
,
"
\t\t
a += %zd;
\n
"
,
offsetof
(
struct
sockaddr_in6
,
sin6_addr
));
Fh
(
tl
,
0
,
"
\t
else {
\n
"
);
Fh
(
tl
,
0
,
"
\t
else {
\n
"
);
Fh
(
tl
,
0
,
"
\t\t
VRT_acl_log(
sp
,
\"
NO_FAM %s
\"
);
\n
"
,
acln
);
Fh
(
tl
,
0
,
"
\t\t
VRT_acl_log(
req
,
\"
NO_FAM %s
\"
);
\n
"
,
acln
);
Fh
(
tl
,
0
,
"
\t\t
return(0);
\n
"
);
Fh
(
tl
,
0
,
"
\t\t
return(0);
\n
"
);
Fh
(
tl
,
0
,
"
\t
}
\n\n
"
);
Fh
(
tl
,
0
,
"
\t
}
\n\n
"
);
depth
=
-
1
;
depth
=
-
1
;
...
@@ -424,7 +424,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
...
@@ -424,7 +424,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
i
=
(
ae
->
mask
+
7
)
/
8
;
i
=
(
ae
->
mask
+
7
)
/
8
;
if
(
!
anon
)
{
if
(
!
anon
)
{
Fh
(
tl
,
0
,
"
\t
%*sVRT_acl_log(
sp
,
\"
%sMATCH %s
\"
"
,
Fh
(
tl
,
0
,
"
\t
%*sVRT_acl_log(
req
,
\"
%sMATCH %s
\"
"
,
-
i
,
""
,
ae
->
not
?
"NEG_"
:
""
,
acln
);
-
i
,
""
,
ae
->
not
?
"NEG_"
:
""
,
acln
);
EncToken
(
tl
->
fh
,
ae
->
t_addr
);
EncToken
(
tl
->
fh
,
ae
->
t_addr
);
if
(
ae
->
t_mask
!=
NULL
)
if
(
ae
->
t_mask
!=
NULL
)
...
@@ -441,7 +441,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
...
@@ -441,7 +441,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
/* Deny by default */
/* Deny by default */
if
(
!
anon
)
if
(
!
anon
)
Fh
(
tl
,
0
,
"
\t
VRT_acl_log(
sp
,
\"
NO_MATCH %s
\"
);
\n
"
,
acln
);
Fh
(
tl
,
0
,
"
\t
VRT_acl_log(
req
,
\"
NO_MATCH %s
\"
);
\n
"
,
acln
);
Fh
(
tl
,
0
,
"
\t
return (0);
\n
}
\n
"
);
Fh
(
tl
,
0
,
"
\t
return (0);
\n
}
\n
"
);
}
}
...
@@ -457,7 +457,7 @@ vcc_Acl_Hack(struct vcc *tl, char *b)
...
@@ -457,7 +457,7 @@ vcc_Acl_Hack(struct vcc *tl, char *b)
bprintf
(
acln
,
"%u"
,
tl
->
unique
++
);
bprintf
(
acln
,
"%u"
,
tl
->
unique
++
);
vcc_acl_entry
(
tl
);
vcc_acl_entry
(
tl
);
vcc_acl_emit
(
tl
,
acln
,
1
);
vcc_acl_emit
(
tl
,
acln
,
1
);
sprintf
(
b
,
"%smatch_acl_anon_%s(
sp
,
\v
1)"
,
sprintf
(
b
,
"%smatch_acl_anon_%s(
req
,
\v
1)"
,
(
tcond
==
T_NEQ
?
"!"
:
""
),
acln
);
(
tcond
==
T_NEQ
?
"!"
:
""
),
acln
);
}
}
...
...
lib/libvcl/vcc_action.c
View file @
acab05e0
...
@@ -238,7 +238,7 @@ parse_panic(struct vcc *tl)
...
@@ -238,7 +238,7 @@ parse_panic(struct vcc *tl)
{
{
vcc_NextToken
(
tl
);
vcc_NextToken
(
tl
);
Fb
(
tl
,
1
,
"VRT_panic(
sp
, "
);
Fb
(
tl
,
1
,
"VRT_panic(
req
, "
);
vcc_Expr
(
tl
,
STRING
);
vcc_Expr
(
tl
,
STRING
);
ERRCHK
(
tl
);
ERRCHK
(
tl
);
Fb
(
tl
,
0
,
", vrt_magic_string_end);
\n
"
);
Fb
(
tl
,
0
,
", vrt_magic_string_end);
\n
"
);
...
...
lib/libvcl/vcc_expr.c
View file @
acab05e0
...
@@ -466,7 +466,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
...
@@ -466,7 +466,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
p
=
vcc_regexp
(
tl
);
p
=
vcc_regexp
(
tl
);
vcc_NextToken
(
tl
);
vcc_NextToken
(
tl
);
bprintf
(
buf
,
"VRT_regsub(
sp
, %d,
\n\v
1,
\n
%s
\n
"
,
all
,
p
);
bprintf
(
buf
,
"VRT_regsub(
req
, %d,
\n\v
1,
\n
%s
\n
"
,
all
,
p
);
*
e
=
vcc_expr_edit
(
STRING
,
buf
,
e2
,
*
e
);
*
e
=
vcc_expr_edit
(
STRING
,
buf
,
e2
,
*
e
);
SkipToken
(
tl
,
','
);
SkipToken
(
tl
,
','
);
...
@@ -947,7 +947,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
...
@@ -947,7 +947,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
re
=
vcc_regexp
(
tl
);
re
=
vcc_regexp
(
tl
);
ERRCHK
(
tl
);
ERRCHK
(
tl
);
vcc_NextToken
(
tl
);
vcc_NextToken
(
tl
);
bprintf
(
buf
,
"%sVRT_re_match(
sp
,
\v
1, %s)"
,
not
,
re
);
bprintf
(
buf
,
"%sVRT_re_match(
req
,
\v
1, %s)"
,
not
,
re
);
*
e
=
vcc_expr_edit
(
BOOL
,
buf
,
*
e
,
NULL
);
*
e
=
vcc_expr_edit
(
BOOL
,
buf
,
*
e
,
NULL
);
return
;
return
;
}
}
...
@@ -957,7 +957,8 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
...
@@ -957,7 +957,8 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
vcc_NextToken
(
tl
);
vcc_NextToken
(
tl
);
ExpectErr
(
tl
,
ID
);
ExpectErr
(
tl
,
ID
);
vcc_AddRef
(
tl
,
tl
->
t
,
SYM_ACL
);
vcc_AddRef
(
tl
,
tl
->
t
,
SYM_ACL
);
bprintf
(
buf
,
"%smatch_acl_named_%.*s(sp,
\v
1)"
,
not
,
PF
(
tl
->
t
));
bprintf
(
buf
,
"%smatch_acl_named_%.*s(req,
\v
1)"
,
not
,
PF
(
tl
->
t
));
vcc_NextToken
(
tl
);
vcc_NextToken
(
tl
);
*
e
=
vcc_expr_edit
(
BOOL
,
buf
,
*
e
,
NULL
);
*
e
=
vcc_expr_edit
(
BOOL
,
buf
,
*
e
,
NULL
);
return
;
return
;
...
...
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