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
e0bed1af
Commit
e0bed1af
authored
Jun 21, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the length field to the front of entries in the vary string.
parent
749b6d68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
cache_vary.c
bin/varnishd/cache_vary.c
+17
-19
No files found.
bin/varnishd/cache_vary.c
View file @
e0bed1af
...
...
@@ -41,13 +41,13 @@
* The vary matching string has the following format:
*
* Sequence of: {
* <msb> \ Length of header contents.
* <lsb> /
* <length of header + 1> \
* <header> \ Same format as argument to http_GetHdr()
* ':' /
* '\0' /
* <msb> \ Length of header contents.
* <lsb> /
* <header> Only present if length != 0xffff
* <header> > Only present if length != 0xffff
* }
* '\0'
*/
...
...
@@ -97,9 +97,6 @@ VRY_Create(const struct sess *sp, const struct http *hp)
(
char
)(
1
+
(
q
-
p
)),
(
int
)(
q
-
p
),
p
,
0
);
AZ
(
VSB_finish
(
sbh
));
/* Append to vary matching string */
VSB_bcat
(
sb
,
VSB_data
(
sbh
),
VSB_len
(
sbh
));
if
(
http_GetHdr
(
sp
->
http
,
VSB_data
(
sbh
),
&
h
))
{
/* Trim leading and trailing space */
while
(
isspace
(
*
h
))
...
...
@@ -110,12 +107,15 @@ VRY_Create(const struct sess *sp, const struct http *hp)
/* Encode two byte length and contents */
l
=
e
-
h
;
assert
(
!
(
l
&
~
0xffff
));
VSB_printf
(
sb
,
"%c%c"
,
(
unsigned
)
l
>>
8
,
l
&
0xff
);
VSB_bcat
(
sb
,
h
,
e
-
h
);
}
else
{
/* Mark as "not present" */
VSB_printf
(
sb
,
"%c%c"
,
0xff
,
0xff
)
;
e
=
h
;
l
=
0xffff
;
}
VSB_printf
(
sb
,
"%c%c"
,
(
unsigned
)
l
>>
8
,
l
&
0xff
);
/* Append to vary matching string */
VSB_bcat
(
sb
,
VSB_data
(
sbh
),
VSB_len
(
sbh
));
if
(
e
!=
h
)
VSB_bcat
(
sb
,
h
,
e
-
h
);
while
(
isspace
(
*
q
))
q
++
;
...
...
@@ -125,7 +125,7 @@ VRY_Create(const struct sess *sp, const struct http *hp)
p
=
q
;
}
/* Terminate vary matching string */
VSB_printf
(
sb
,
"%c
"
,
0
);
VSB_printf
(
sb
,
"%c
%c%c"
,
0xff
,
0xff
,
0
);
VSB_delete
(
sbh
);
AZ
(
VSB_finish
(
sb
));
...
...
@@ -133,12 +133,16 @@ VRY_Create(const struct sess *sp, const struct http *hp)
}
int
VRY_Match
(
const
struct
sess
*
sp
,
const
u
nsigned
char
*
vary
)
VRY_Match
(
const
struct
sess
*
sp
,
const
u
int8_t
*
vary
)
{
char
*
h
,
*
e
;
int
i
,
l
,
lh
;
while
(
*
vary
)
{
while
(
1
)
{
l
=
vary
[
0
]
*
256
+
vary
[
1
];
vary
+=
2
;
if
(
!*
vary
)
break
;
if
(
params
->
http_gzip_support
&&
!
strcasecmp
(
H_Accept_Encoding
,
(
const
char
*
)
vary
))
{
...
...
@@ -152,8 +156,6 @@ VRY_Match(const struct sess *sp, const unsigned char *vary)
* setting of http_gzip_support.
*/
vary
+=
*
vary
+
2
;
l
=
vary
[
0
]
*
256
+
vary
[
1
];
vary
+=
2
;
if
(
l
!=
0xffff
)
vary
+=
l
;
continue
;
...
...
@@ -162,10 +164,6 @@ VRY_Match(const struct sess *sp, const unsigned char *vary)
i
=
http_GetHdr
(
sp
->
http
,
(
const
char
*
)
vary
,
&
h
);
vary
+=
*
vary
+
2
;
/* Expected length of header (or 0xffff) */
l
=
vary
[
0
]
*
256
+
vary
[
1
];
vary
+=
2
;
/* Fail if we have the header, but shouldn't */
if
(
i
&&
l
==
0xffff
)
return
(
0
);
...
...
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