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
66483710
Commit
66483710
authored
Jan 22, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buffer the pending bytes until we need them.
parent
ee4a4eec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
15 deletions
+40
-15
cache_esi_fetch.c
bin/varnishd/cache_esi_fetch.c
+40
-15
No files found.
bin/varnishd/cache_esi_fetch.c
View file @
66483710
...
@@ -138,6 +138,8 @@ struct vef_priv {
...
@@ -138,6 +138,8 @@ struct vef_priv {
char
*
bufp
;
char
*
bufp
;
ssize_t
tot
;
ssize_t
tot
;
int
error
;
int
error
;
char
pending
[
20
];
ssize_t
npend
;
};
};
/*---------------------------------------------------------------------
/*---------------------------------------------------------------------
...
@@ -148,7 +150,7 @@ static ssize_t
...
@@ -148,7 +150,7 @@ static ssize_t
vfp_vep_callback
(
const
struct
sess
*
sp
,
ssize_t
l
,
enum
vgz_flag
flg
)
vfp_vep_callback
(
const
struct
sess
*
sp
,
ssize_t
l
,
enum
vgz_flag
flg
)
{
{
struct
vef_priv
*
vef
;
struct
vef_priv
*
vef
;
size_t
dl
;
size_t
dl
,
px
;
const
void
*
dp
;
const
void
*
dp
;
int
i
;
int
i
;
...
@@ -162,23 +164,42 @@ vfp_vep_callback(const struct sess *sp, ssize_t l, enum vgz_flag flg)
...
@@ -162,23 +164,42 @@ vfp_vep_callback(const struct sess *sp, ssize_t l, enum vgz_flag flg)
return
(
vef
->
tot
);
return
(
vef
->
tot
);
}
}
/* This would just give Z_BUF_ERROR anyway */
/*
* l == 0 is valid when 'flg' calls for action, but in the
* normal case we can just ignore a l==0 request.
* (It would cause Z_BUF_ERROR anyway)
*/
if
(
l
==
0
&&
flg
==
VGZ_NORMAL
)
if
(
l
==
0
&&
flg
==
VGZ_NORMAL
)
return
(
vef
->
tot
);
return
(
vef
->
tot
);
printf
(
"xxC %jd
\n
"
,
l
);
VGZ_Ibuf
(
vef
->
vgz
,
vef
->
bufp
,
l
);
do
{
do
{
if
(
VGZ_ObufStorage
(
sp
,
vef
->
vgz
))
{
px
=
vef
->
npend
;
vef
->
error
=
ENOMEM
;
if
(
l
<
px
)
vef
->
tot
+=
l
;
px
=
l
;
return
(
vef
->
tot
);
if
(
px
!=
0
)
{
VGZ_Ibuf
(
vef
->
vgz
,
vef
->
pending
,
px
);
l
-=
px
;
}
else
{
VGZ_Ibuf
(
vef
->
vgz
,
vef
->
bufp
,
l
);
vef
->
bufp
+=
l
;
l
=
0
;
}
}
i
=
VGZ_Gzip
(
vef
->
vgz
,
&
dp
,
&
dl
,
flg
);
do
{
vef
->
tot
+=
dl
;
if
(
VGZ_ObufStorage
(
sp
,
vef
->
vgz
))
{
sp
->
obj
->
len
+=
dl
;
vef
->
error
=
errno
;
}
while
(
!
VGZ_IbufEmpty
(
vef
->
vgz
));
vef
->
tot
+=
l
;
vef
->
bufp
+=
l
;
return
(
vef
->
tot
);
}
i
=
VGZ_Gzip
(
vef
->
vgz
,
&
dp
,
&
dl
,
flg
);
vef
->
tot
+=
dl
;
sp
->
obj
->
len
+=
dl
;
}
while
(
!
VGZ_IbufEmpty
(
vef
->
vgz
));
if
(
px
!=
0
)
{
memmove
(
vef
->
pending
,
vef
->
pending
+
px
,
vef
->
npend
-
px
);
vef
->
npend
-=
px
;
}
}
while
(
l
>
0
);
if
(
flg
==
VGZ_FINISH
)
if
(
flg
==
VGZ_FINISH
)
assert
(
i
==
1
);
/* XXX */
assert
(
i
==
1
);
/* XXX */
else
else
...
@@ -203,13 +224,17 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, ssize_t bytes)
...
@@ -203,13 +224,17 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, ssize_t bytes)
return
(
w
);
return
(
w
);
bytes
-=
w
;
bytes
-=
w
;
vef
->
bufp
=
ibuf
;
vef
->
bufp
=
ibuf
;
printf
(
"xxP %jd
\n
"
,
w
);
VEP_parse
(
sp
,
ibuf
,
w
);
VEP_parse
(
sp
,
ibuf
,
w
);
if
(
vef
->
error
)
{
if
(
vef
->
error
)
{
errno
=
vef
->
error
;
errno
=
vef
->
error
;
return
(
-
1
);
return
(
-
1
);
}
}
assert
(
vef
->
bufp
==
ibuf
+
w
);
if
(
vef
->
bufp
<
ibuf
+
w
)
{
w
=
(
ibuf
+
w
)
-
vef
->
bufp
;
assert
(
w
+
vef
->
npend
<
sizeof
vef
->
pending
);
memcpy
(
vef
->
pending
+
vef
->
npend
,
vef
->
bufp
,
w
);
vef
->
npend
+=
w
;
}
}
}
return
(
1
);
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