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
Show 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 {
char
*
bufp
;
ssize_t
tot
;
int
error
;
char
pending
[
20
];
ssize_t
npend
;
};
/*---------------------------------------------------------------------
...
...
@@ -148,7 +150,7 @@ static ssize_t
vfp_vep_callback
(
const
struct
sess
*
sp
,
ssize_t
l
,
enum
vgz_flag
flg
)
{
struct
vef_priv
*
vef
;
size_t
dl
;
size_t
dl
,
px
;
const
void
*
dp
;
int
i
;
...
...
@@ -162,15 +164,29 @@ vfp_vep_callback(const struct sess *sp, ssize_t l, enum vgz_flag flg)
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
)
return
(
vef
->
tot
);
printf
(
"xxC %jd
\n
"
,
l
);
do
{
px
=
vef
->
npend
;
if
(
l
<
px
)
px
=
l
;
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
;
}
do
{
if
(
VGZ_ObufStorage
(
sp
,
vef
->
vgz
))
{
vef
->
error
=
ENOMEM
;
vef
->
error
=
errno
;
vef
->
tot
+=
l
;
return
(
vef
->
tot
);
}
...
...
@@ -178,7 +194,12 @@ printf("xxC %jd\n", l);
vef
->
tot
+=
dl
;
sp
->
obj
->
len
+=
dl
;
}
while
(
!
VGZ_IbufEmpty
(
vef
->
vgz
));
vef
->
bufp
+=
l
;
if
(
px
!=
0
)
{
memmove
(
vef
->
pending
,
vef
->
pending
+
px
,
vef
->
npend
-
px
);
vef
->
npend
-=
px
;
}
}
while
(
l
>
0
);
if
(
flg
==
VGZ_FINISH
)
assert
(
i
==
1
);
/* XXX */
else
...
...
@@ -203,13 +224,17 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, ssize_t bytes)
return
(
w
);
bytes
-=
w
;
vef
->
bufp
=
ibuf
;
printf
(
"xxP %jd
\n
"
,
w
);
VEP_parse
(
sp
,
ibuf
,
w
);
if
(
vef
->
error
)
{
errno
=
vef
->
error
;
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
);
}
...
...
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