Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
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
varnishevent3
Commits
8aa94940
Commit
8aa94940
authored
Mar 31, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't assume esi-spec lengths match up with storage segments.
parent
40e09c27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
34 deletions
+64
-34
cache_esi_deliver.c
bin/varnishd/cache_esi_deliver.c
+64
-34
No files found.
bin/varnishd/cache_esi_deliver.c
View file @
8aa94940
...
@@ -225,7 +225,7 @@ ESI_Deliver(struct sess *sp)
...
@@ -225,7 +225,7 @@ ESI_Deliver(struct sess *sp)
struct
storage
*
st
;
struct
storage
*
st
;
uint8_t
*
p
,
*
e
,
*
q
,
*
r
;
uint8_t
*
p
,
*
e
,
*
q
,
*
r
;
unsigned
off
;
unsigned
off
;
ssize_t
l
,
l_icrc
=
0
;
ssize_t
l
,
l
2
,
l
_icrc
=
0
;
uint32_t
icrc
=
0
;
uint32_t
icrc
=
0
;
uint8_t
tailbuf
[
8
+
5
];
uint8_t
tailbuf
[
8
+
5
];
int
isgzip
;
int
isgzip
;
...
@@ -291,7 +291,6 @@ ESI_Deliver(struct sess *sp)
...
@@ -291,7 +291,6 @@ ESI_Deliver(struct sess *sp)
case
VEC_V2
:
case
VEC_V2
:
case
VEC_V8
:
case
VEC_V8
:
l
=
ved_decode_len
(
&
p
);
l
=
ved_decode_len
(
&
p
);
r
=
p
;
if
(
isgzip
)
{
if
(
isgzip
)
{
assert
(
*
p
==
VEC_C1
||
*
p
==
VEC_C2
||
assert
(
*
p
==
VEC_C1
||
*
p
==
VEC_C2
||
*
p
==
VEC_C8
);
*
p
==
VEC_C8
);
...
@@ -299,45 +298,76 @@ ESI_Deliver(struct sess *sp)
...
@@ -299,45 +298,76 @@ ESI_Deliver(struct sess *sp)
icrc
=
vbe32dec
(
p
);
icrc
=
vbe32dec
(
p
);
p
+=
4
;
p
+=
4
;
}
}
/*
* There is no guarantee that the 'l' bytes are all
* in the same storage segment, so loop over storage
* until we have processed them all.
*/
while
(
l
>
0
)
{
l2
=
l
;
if
(
l2
>
st
->
len
-
off
)
l2
=
st
->
len
-
off
;
l
-=
l2
;
if
(
sp
->
wrk
->
gzip_resp
&&
isgzip
)
{
if
(
sp
->
wrk
->
gzip_resp
&&
isgzip
)
{
/*
/*
* We have a gzip'ed VEC and delivers a
* We have a gzip'ed VEC and delivers
*
gzip'ed ESI response.
* a
gzip'ed ESI response.
*/
*/
sp
->
wrk
->
crc
=
crc32_combine
(
sp
->
wrk
->
crc
=
crc32_combine
(
sp
->
wrk
->
crc
,
icrc
,
l_icrc
);
sp
->
wrk
->
crc
,
icrc
,
l_icrc
);
sp
->
wrk
->
l_crc
+=
l_icrc
;
sp
->
wrk
->
l_crc
+=
l_icrc
;
WRW_Write
(
sp
->
wrk
,
st
->
ptr
+
off
,
l
);
WRW_Write
(
sp
->
wrk
,
st
->
ptr
+
off
,
l2
);
}
else
if
(
sp
->
wrk
->
gzip_resp
)
{
}
else
if
(
sp
->
wrk
->
gzip_resp
)
{
/*
/*
* A gzip'ed ESI response, but the VEC was
* A gzip'ed ESI response, but the VEC
*
not gzip'ed.
* was
not gzip'ed.
*/
*/
ved_pretend_gzip
(
sp
,
st
->
ptr
+
off
,
l
);
ved_pretend_gzip
(
sp
,
st
->
ptr
+
off
,
l2
);
off
+=
l
;
}
else
if
(
isgzip
)
{
}
else
if
(
isgzip
)
{
/*
/*
* A gzip'ed VEC, but ungzip'ed ESI response
* A gzip'ed VEC, but ungzip'ed ESI
* response
*/
*/
AN
(
vgz
);
AN
(
vgz
);
i
=
VGZ_WrwGunzip
(
sp
,
vgz
,
i
=
VGZ_WrwGunzip
(
sp
,
vgz
,
st
->
ptr
+
off
,
l
,
st
->
ptr
+
off
,
l2
,
obuf
,
sizeof
obuf
,
&
obufl
);
obuf
,
sizeof
obuf
,
&
obufl
);
assert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
assert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
}
else
{
}
else
{
/*
/*
* Ungzip'ed VEC, ungzip'ed ESI response
* Ungzip'ed VEC, ungzip'ed ESI response
*/
*/
WRW_Write
(
sp
->
wrk
,
st
->
ptr
+
off
,
l
);
WRW_Write
(
sp
->
wrk
,
st
->
ptr
+
off
,
l2
);
}
off
+=
l2
;
if
(
off
==
st
->
len
)
{
st
=
VTAILQ_NEXT
(
st
,
list
);
off
=
0
;
}
}
}
off
+=
l
;
break
;
break
;
case
VEC_S1
:
case
VEC_S1
:
case
VEC_S2
:
case
VEC_S2
:
case
VEC_S8
:
case
VEC_S8
:
l
=
ved_decode_len
(
&
p
);
l
=
ved_decode_len
(
&
p
);
Debug
(
"SKIP1(%d)
\n
"
,
(
int
)
l
);
Debug
(
"SKIP1(%d)
\n
"
,
(
int
)
l
);
off
+=
l
;
/*
* There is no guarantee that the 'l' bytes are all
* in the same storage segment, so loop over storage
* until we have processed them all.
*/
while
(
l
>
0
)
{
l2
=
l
;
if
(
l2
>
st
->
len
-
off
)
l2
=
st
->
len
-
off
;
l
-=
l2
;
off
+=
l2
;
if
(
off
==
st
->
len
)
{
st
=
VTAILQ_NEXT
(
st
,
list
);
off
=
0
;
}
}
break
;
break
;
case
VEC_INCL
:
case
VEC_INCL
:
p
++
;
p
++
;
...
...
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