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
b2190582
Commit
b2190582
authored
Jul 31, 2013
by
Joshua Bussdieker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Request must match their own Key header rules to get saved.
parent
0e07764e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+3
-1
cache_hash.c
bin/varnishd/cache/cache_hash.c
+2
-2
cache_key.c
bin/varnishd/cache/cache_key.c
+11
-5
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
b2190582
...
...
@@ -315,7 +315,9 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
VSLb
(
bo
->
vsl
,
SLT_Error
,
"Illegal 'Key' header from backend, "
"making this a pass."
);
bo
->
uncacheable
=
1
;
// We're willing to try again
bo
->
exp
.
ttl
=
0
;
AZ
(
key
);
}
else
{
#endif
...
...
bin/varnishd/cache/cache_hash.c
View file @
b2190582
...
...
@@ -376,7 +376,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
#ifdef KEY_HEADER
if
(
oc
->
busyobj
!=
NULL
&&
oc
->
busyobj
->
key
!=
NULL
&&
!
KEY_Match
(
req
,
oc
->
busyobj
->
key
))
!
KEY_Match
(
req
->
http
,
oc
->
busyobj
->
key
))
continue
;
#endif
...
...
@@ -397,7 +397,7 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if
(
BAN_CheckObject
(
o
,
req
))
continue
;
#ifdef KEY_HEADER
if
(
o
->
key
!=
NULL
&&
!
KEY_Match
(
req
,
o
->
key
))
if
(
o
->
key
!=
NULL
&&
!
KEY_Match
(
req
->
http
,
o
->
key
))
continue
;
#endif
if
(
o
->
vary
!=
NULL
&&
!
VRY_Match
(
req
,
o
->
vary
))
...
...
bin/varnishd/cache/cache_key.c
View file @
b2190582
...
...
@@ -244,6 +244,12 @@ KEY_Create(struct busyobj *bo, struct vsb **psb)
VSB_delete
(
sbh
);
AZ
(
VSB_finish
(
sb
));
if
(
KEY_Match
(
bo
->
bereq
,
VSB_data
(
sb
))
==
0
)
{
printf
(
"That doesn't match this req wth
\n
"
);
return
-
1
;
}
*
psb
=
sb
;
DEBUG
&&
printf
(
"KEY_Create(bo: %p, psb: %p) = %zu
\n
"
,
bo
,
*
psb
,
VSB_len
(
sb
));
DEBUG
&&
hexDump
(
"key"
,
VSB_data
(
sb
),
VSB_len
(
sb
));
...
...
@@ -279,9 +285,9 @@ int word_match(char *param, char *string) {
}
int
KEY_Match
(
struct
req
*
req
,
const
uint8_t
*
key
)
KEY_Match
(
struct
http
*
http
,
const
uint8_t
*
key
)
{
DEBUG
&&
printf
(
"KEY_Match(
req: %p, key: %p)
\n
"
,
req
,
key
);
DEBUG
&&
printf
(
"KEY_Match(
http: %p, key: %p)
\n
"
,
http
,
key
);
char
*
h
;
int
i
;
...
...
@@ -297,7 +303,7 @@ KEY_Match(struct req *req, const uint8_t *key)
DEBUG
&&
printf
(
" Header (Exact): %s
\n
"
,
key
+
4
);
i
=
http_GetHdr
(
req
->
http
,
(
const
char
*
)(
key
+
3
),
&
h
);
i
=
http_GetHdr
(
http
,
(
const
char
*
)(
key
+
3
),
&
h
);
if
(
l
==
0xFFFF
)
{
// Expect missing
...
...
@@ -351,7 +357,7 @@ KEY_Match(struct req *req, const uint8_t *key)
char
*
e
;
unsigned
l
=
vbe16dec
(
key
);
i
=
http_GetHdr
(
req
->
http
,
(
const
char
*
)(
key
+
3
),
&
h
);
i
=
http_GetHdr
(
http
,
(
const
char
*
)(
key
+
3
),
&
h
);
// TODO: Perhaps not matcher should allow this
if
(
i
==
0
)
...
...
@@ -381,6 +387,6 @@ KEY_Match(struct req *req, const uint8_t *key)
key
+=
key_len
(
key
);
}
DEBUG
&&
printf
(
"KEY_Match(
req: %p, key: %p) = 1
\n
"
,
req
,
key
);
DEBUG
&&
printf
(
"KEY_Match(
http: %p, key: %p) = 1
\n
"
,
http
,
key
);
return
1
;
}
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