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
12b3a911
Commit
12b3a911
authored
Aug 02, 2013
by
Joshua Bussdieker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Multiheader support
parent
8ce3713d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
11 deletions
+44
-11
cache_http.c
bin/varnishd/cache/cache_http.c
+26
-0
cache_key.c
bin/varnishd/cache/cache_key.c
+18
-11
No files found.
bin/varnishd/cache/cache_http.c
View file @
12b3a911
...
...
@@ -279,6 +279,32 @@ http_GetHdr(const struct http *hp, const char *hdr, char **ptr)
return
(
1
);
}
unsigned
http_EnumHdr
(
const
struct
http
*
hp
,
int
offset
,
const
char
*
hdr
,
char
**
ptr
)
{
unsigned
u
,
l
;
char
*
p
;
l
=
hdr
[
0
];
diagnostic
(
l
==
strlen
(
hdr
+
1
));
assert
(
hdr
[
l
]
==
':'
);
for
(
u
=
offset
==
0
?
HTTP_HDR_FIRST
:
offset
;
u
<
hp
->
nhd
;
u
++
)
{
if
(
u
<
hp
->
nhd
&&
http_IsHdr
(
&
hp
->
hd
[
u
],
hdr
))
{
Tcheck
(
hp
->
hd
[
u
]);
p
=
hp
->
hd
[
u
].
b
+
l
;
while
(
vct_issp
(
*
p
))
p
++
;
*
ptr
=
p
;
return
u
+
1
;
}
}
*
ptr
=
NULL
;
return
0
;
}
/*--------------------------------------------------------------------
* Find a given data element in a header according to RFC2616's #rule
...
...
bin/varnishd/cache/cache_key.c
View file @
12b3a911
...
...
@@ -459,32 +459,39 @@ KEY_Match(struct http *http, const uint8_t *key)
unsigned
l
=
vbe16dec
(
key
);
int
not_flag
=
0
;
int
case_flag
=
0
;
i
=
http_GetHdr
(
http
,
(
const
char
*
)(
key
+
3
),
&
h
);
// TODO: Perhaps not matcher should allow this
if
(
i
==
0
)
return
0
;
const
char
*
matcher
=
key
+
4
+
key
[
3
]
+
1
;
while
(
*
matcher
!=
0
&&
*
matcher
!=
-
1
)
{
char
*
m
=
matcher
+
1
;
unsigned
u
=
0
;
int
subresult
=
0
;
switch
(
matcher
[
0
])
{
case
M_WORD
:
if
(
!
word_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
)
^
not_flag
)
while
(
u
=
http_EnumHdr
(
http
,
u
,
(
const
char
*
)(
key
+
3
),
&
h
))
{
subresult
|=
word_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
);
}
if
(
!
(
subresult
^
not_flag
))
result
=
0
;
break
;
case
M_SUBSTRING
:
if
(
!
substring_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
)
^
not_flag
)
while
(
u
=
http_EnumHdr
(
http
,
u
,
(
const
char
*
)(
key
+
3
),
&
h
))
{
subresult
|=
substring_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
);
}
if
(
!
(
subresult
^
not_flag
))
result
=
0
;
break
;
case
M_BEGINNING
:
if
(
!
beginning_substring_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
)
^
not_flag
)
while
(
u
=
http_EnumHdr
(
http
,
u
,
(
const
char
*
)(
key
+
3
),
&
h
))
{
subresult
|=
beginning_substring_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
);
}
if
(
!
(
subresult
^
not_flag
))
result
=
0
;
break
;
case
M_PARAMETER
:
if
(
!
parameter_prefix_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
)
^
not_flag
)
while
(
u
=
http_EnumHdr
(
http
,
u
,
(
const
char
*
)(
key
+
3
),
&
h
))
{
subresult
|=
parameter_prefix_matcher
(
m
,
h
,
strlen
(
m
),
case_flag
);
}
if
(
!
(
subresult
^
not_flag
))
result
=
0
;
break
;
case
M_CASE
:
...
...
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