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
2fceda5d
Commit
2fceda5d
authored
Oct 31, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the VFP calls symmetric and pair-wise visible, allow ->end()
to fail, and act accordingly.
parent
a0db44fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
cache_fetch.c
bin/varnishd/cache_fetch.c
+15
-11
No files found.
bin/varnishd/cache_fetch.c
View file @
2fceda5d
...
@@ -198,15 +198,12 @@ fetch_number(const char *nbr, int radix)
...
@@ -198,15 +198,12 @@ fetch_number(const char *nbr, int radix)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
static
int
static
int
fetch_straight
(
struct
worker
*
w
,
struct
http_conn
*
htc
,
const
char
*
b
)
fetch_straight
(
struct
worker
*
w
,
struct
http_conn
*
htc
,
ssize_t
cl
)
{
{
int
i
;
int
i
;
ssize_t
cl
;
assert
(
w
->
body_status
==
BS_LENGTH
);
assert
(
w
->
body_status
==
BS_LENGTH
);
cl
=
fetch_number
(
b
,
10
);
w
->
vfp
->
begin
(
w
,
cl
>
0
?
cl
:
0
);
if
(
cl
<
0
)
{
if
(
cl
<
0
)
{
WSLB
(
w
,
SLT_FetchError
,
"straight length field bogus"
);
WSLB
(
w
,
SLT_FetchError
,
"straight length field bogus"
);
return
(
-
1
);
return
(
-
1
);
...
@@ -242,7 +239,6 @@ fetch_chunked(struct worker *w, struct http_conn *htc)
...
@@ -242,7 +239,6 @@ fetch_chunked(struct worker *w, struct http_conn *htc)
unsigned
u
;
unsigned
u
;
ssize_t
cl
;
ssize_t
cl
;
w
->
vfp
->
begin
(
w
,
0
);
assert
(
w
->
body_status
==
BS_CHUNKED
);
assert
(
w
->
body_status
==
BS_CHUNKED
);
do
{
do
{
/* Skip leading whitespace */
/* Skip leading whitespace */
...
@@ -310,7 +306,6 @@ fetch_eof(struct worker *w, struct http_conn *htc)
...
@@ -310,7 +306,6 @@ fetch_eof(struct worker *w, struct http_conn *htc)
int
i
;
int
i
;
assert
(
w
->
body_status
==
BS_EOF
);
assert
(
w
->
body_status
==
BS_EOF
);
w
->
vfp
->
begin
(
w
,
0
);
i
=
w
->
vfp
->
bytes
(
w
,
htc
,
SSIZE_MAX
);
i
=
w
->
vfp
->
bytes
(
w
,
htc
,
SSIZE_MAX
);
if
(
i
<
0
)
{
if
(
i
<
0
)
{
WSLB
(
w
,
SLT_FetchError
,
"eof read_error: %d (%s)"
,
WSLB
(
w
,
SLT_FetchError
,
"eof read_error: %d (%s)"
,
...
@@ -485,6 +480,7 @@ FetchBody(struct worker *w, struct object *obj)
...
@@ -485,6 +480,7 @@ FetchBody(struct worker *w, struct object *obj)
int
cls
;
int
cls
;
struct
storage
*
st
;
struct
storage
*
st
;
int
mklen
;
int
mklen
;
ssize_t
cl
;
CHECK_OBJ_NOTNULL
(
w
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
w
,
WORKER_MAGIC
);
AZ
(
w
->
fetch_obj
);
AZ
(
w
->
fetch_obj
);
...
@@ -502,6 +498,8 @@ FetchBody(struct worker *w, struct object *obj)
...
@@ -502,6 +498,8 @@ FetchBody(struct worker *w, struct object *obj)
w
->
fetch_obj
=
obj
;
w
->
fetch_obj
=
obj
;
/* XXX: pick up estimate from objdr ? */
cl
=
0
;
switch
(
w
->
body_status
)
{
switch
(
w
->
body_status
)
{
case
BS_NONE
:
case
BS_NONE
:
cls
=
0
;
cls
=
0
;
...
@@ -512,20 +510,26 @@ FetchBody(struct worker *w, struct object *obj)
...
@@ -512,20 +510,26 @@ FetchBody(struct worker *w, struct object *obj)
mklen
=
1
;
mklen
=
1
;
break
;
break
;
case
BS_LENGTH
:
case
BS_LENGTH
:
cls
=
fetch_straight
(
w
,
w
->
htc
,
cl
=
fetch_number
(
w
->
h_content_length
,
10
);
w
->
h_content_length
);
w
->
vfp
->
begin
(
w
,
cl
>
0
?
cl
:
0
);
cls
=
fetch_straight
(
w
,
w
->
htc
,
cl
);
mklen
=
1
;
mklen
=
1
;
XXXAZ
(
w
->
vfp
->
end
(
w
));
if
(
w
->
vfp
->
end
(
w
))
cls
=
-
1
;
break
;
break
;
case
BS_CHUNKED
:
case
BS_CHUNKED
:
w
->
vfp
->
begin
(
w
,
cl
);
cls
=
fetch_chunked
(
w
,
w
->
htc
);
cls
=
fetch_chunked
(
w
,
w
->
htc
);
mklen
=
1
;
mklen
=
1
;
XXXAZ
(
w
->
vfp
->
end
(
w
));
if
(
w
->
vfp
->
end
(
w
))
cls
=
-
1
;
break
;
break
;
case
BS_EOF
:
case
BS_EOF
:
w
->
vfp
->
begin
(
w
,
cl
);
cls
=
fetch_eof
(
w
,
w
->
htc
);
cls
=
fetch_eof
(
w
,
w
->
htc
);
mklen
=
1
;
mklen
=
1
;
XXXAZ
(
w
->
vfp
->
end
(
w
));
if
(
w
->
vfp
->
end
(
w
))
cls
=
-
1
;
break
;
break
;
case
BS_ERROR
:
case
BS_ERROR
:
cls
=
1
;
cls
=
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