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
37e6f871
Commit
37e6f871
authored
Aug 13, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete obj->objcore change for bans
parent
67180503
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
cache_ban.c
bin/varnishd/cache/cache_ban.c
+9
-14
cache_http.c
bin/varnishd/cache/cache_http.c
+7
-4
No files found.
bin/varnishd/cache/cache_ban.c
View file @
37e6f871
...
...
@@ -827,13 +827,13 @@ BAN_Compile(void)
*/
static
int
ban_evaluate
(
const
uint8_t
*
bs
,
const
struct
http
*
objhttp
,
ban_evaluate
(
const
uint8_t
*
bs
,
struct
objcore
*
oc
,
struct
dstat
*
ds
,
const
struct
http
*
reqhttp
,
unsigned
*
tests
)
{
struct
ban_test
bt
;
const
uint8_t
*
be
;
char
*
arg1
;
c
har
buf
[
10
]
;
char
*
p
;
c
onst
char
*
arg1
;
be
=
bs
+
ban_len
(
bs
);
bs
+=
13
;
...
...
@@ -848,14 +848,14 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
break
;
case
BANS_ARG_REQHTTP
:
AN
(
reqhttp
);
(
void
)
http_GetHdr
(
reqhttp
,
bt
.
arg1_spec
,
&
arg1
);
(
void
)
http_GetHdr
(
reqhttp
,
bt
.
arg1_spec
,
&
p
);
arg1
=
p
;
break
;
case
BANS_ARG_OBJHTTP
:
(
void
)
http_GetHdr
(
objhttp
,
bt
.
arg1_spec
,
&
arg1
);
arg1
=
HTTP_GetHdrPack
(
oc
,
ds
,
bt
.
arg1_spec
);
break
;
case
BANS_ARG_OBJSTATUS
:
arg1
=
buf
;
sprintf
(
buf
,
"%d"
,
objhttp
->
status
);
arg1
=
HTTP_GetHdrPack
(
oc
,
ds
,
":status"
);
break
;
default:
WRONG
(
"Wrong BAN_ARG code"
);
...
...
@@ -904,7 +904,6 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req)
{
struct
ban
*
b
;
struct
vsl_log
*
vsl
;
struct
object
*
o
;
struct
ban
*
volatile
b0
;
unsigned
tests
;
...
...
@@ -930,10 +929,6 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req)
if
(
b0
==
oc
->
ban
)
return
(
0
);
/* Now we need the object */
o
=
ObjGetObj
(
oc
,
&
wrk
->
stats
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
/*
* This loop is safe without locks, because we know we hold
* a refcount on a ban somewhere in the list and we do not
...
...
@@ -944,7 +939,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req)
CHECK_OBJ_NOTNULL
(
b
,
BAN_MAGIC
);
if
(
b
->
flags
&
BANS_FLAG_COMPLETED
)
continue
;
if
(
ban_evaluate
(
b
->
spec
,
o
->
http
,
req
->
http
,
&
tests
))
if
(
ban_evaluate
(
b
->
spec
,
o
c
,
&
wrk
->
stats
,
req
->
http
,
&
tests
))
break
;
}
...
...
@@ -1096,7 +1091,7 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt,
continue
;
}
tests
=
0
;
i
=
ban_evaluate
(
bl
->
spec
,
o
->
http
,
NULL
,
&
tests
);
i
=
ban_evaluate
(
bl
->
spec
,
o
c
,
&
wrk
->
stats
,
NULL
,
&
tests
);
VSC_C_main
->
bans_lurker_tested
++
;
VSC_C_main
->
bans_lurker_tests_tested
+=
tests
;
if
(
i
)
...
...
bin/varnishd/cache/cache_http.c
View file @
37e6f871
...
...
@@ -733,10 +733,6 @@ HTTP_GetHdrPack(struct objcore *oc, struct dstat *ds, const char *hdr)
AN
(
ds
);
AN
(
hdr
);
l
=
hdr
[
0
];
assert
(
l
==
strlen
(
hdr
+
1
));
assert
(
hdr
[
l
]
==
':'
);
hdr
++
;
ptr
=
ObjGetattr
(
oc
,
ds
,
OA_HEADERS
,
NULL
);
AN
(
ptr
);
...
...
@@ -746,9 +742,16 @@ HTTP_GetHdrPack(struct objcore *oc, struct dstat *ds, const char *hdr)
/* Skip PROTO, STATUS and REASON */
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
if
(
!
strcmp
(
hdr
,
":status"
))
return
(
ptr
);
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
ptr
=
strchr
(
ptr
,
'\0'
)
+
1
;
l
=
hdr
[
0
];
assert
(
l
==
strlen
(
hdr
+
1
));
assert
(
hdr
[
l
]
==
':'
);
hdr
++
;
while
(
*
ptr
!=
'\0'
)
{
if
(
!
strncasecmp
(
ptr
,
hdr
,
l
))
{
ptr
+=
l
;
...
...
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