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