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
4f8456c7
Commit
4f8456c7
authored
Jan 28, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inline three small functions of less generality than expected.
parent
16c934f5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
48 deletions
+14
-48
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+14
-48
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
4f8456c7
...
...
@@ -74,45 +74,6 @@ FetchError(struct busyobj *bo, const char *error)
return
(
FetchError2
(
bo
,
error
,
NULL
));
}
/*--------------------------------------------------------------------
* VFP method functions
*/
static
void
VFP_Begin
(
struct
busyobj
*
bo
,
size_t
estimate
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AN
(
bo
->
vfp
);
bo
->
vfp
->
begin
(
bo
,
estimate
);
}
static
int
VFP_Bytes
(
struct
busyobj
*
bo
,
struct
http_conn
*
htc
,
ssize_t
sz
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AN
(
bo
->
vfp
);
CHECK_OBJ_NOTNULL
(
htc
,
HTTP_CONN_MAGIC
);
assert
(
bo
->
state
==
BOS_FETCHING
);
return
(
bo
->
vfp
->
bytes
(
bo
,
htc
,
sz
));
}
static
void
VFP_End
(
struct
busyobj
*
bo
)
{
int
i
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AN
(
bo
->
vfp
);
i
=
bo
->
vfp
->
end
(
bo
);
if
(
i
)
assert
(
bo
->
state
==
BOS_FAILED
);
}
/*--------------------------------------------------------------------
* VFP_NOP
*
...
...
@@ -283,7 +244,7 @@ fetch_straight(struct busyobj *bo, struct http_conn *htc, ssize_t cl)
}
else
if
(
cl
==
0
)
return
(
0
);
i
=
VFP_B
ytes
(
bo
,
htc
,
cl
);
i
=
bo
->
vfp
->
b
ytes
(
bo
,
htc
,
cl
);
if
(
i
<=
0
)
return
(
FetchError
(
bo
,
"straight insufficient bytes"
));
return
(
0
);
...
...
@@ -341,7 +302,7 @@ fetch_chunked(struct busyobj *bo, struct http_conn *htc)
if
(
cl
<
0
)
return
(
FetchError
(
bo
,
"chunked header number syntax"
));
if
(
cl
>
0
&&
VFP_B
ytes
(
bo
,
htc
,
cl
)
<=
0
)
if
(
cl
>
0
&&
bo
->
vfp
->
b
ytes
(
bo
,
htc
,
cl
)
<=
0
)
return
(
FetchError
(
bo
,
"chunked read err"
));
i
=
HTTP1_Read
(
htc
,
buf
,
1
);
...
...
@@ -362,7 +323,7 @@ fetch_eof(struct busyobj *bo, struct http_conn *htc)
{
assert
(
htc
->
body_status
==
BS_EOF
);
if
(
VFP_B
ytes
(
bo
,
htc
,
SSIZE_MAX
)
<
0
)
if
(
bo
->
vfp
->
b
ytes
(
bo
,
htc
,
SSIZE_MAX
)
<
0
)
(
void
)
FetchError
(
bo
,
"eof socket fail"
);
}
...
...
@@ -553,6 +514,7 @@ FetchBody(struct worker *wrk, void *priv)
if
(
bo
->
vfp
==
NULL
)
bo
->
vfp
=
&
vfp_nop
;
AN
(
bo
->
vfp
);
AZ
(
bo
->
vgz_rx
);
AZ
(
VTAILQ_FIRST
(
&
obj
->
store
));
...
...
@@ -570,26 +532,30 @@ FetchBody(struct worker *wrk, void *priv)
break
;
case
BS_LENGTH
:
cl
=
fetch_number
(
bo
->
h_content_length
,
10
);
VFP_Begin
(
bo
,
cl
>
0
?
cl
:
0
);
bo
->
vfp
->
begin
(
bo
,
cl
>
0
?
cl
:
0
);
if
(
bo
->
state
==
BOS_FETCHING
)
cls
=
fetch_straight
(
bo
,
htc
,
cl
);
mklen
=
1
;
VFP_End
(
bo
);
if
(
bo
->
vfp
->
end
(
bo
))
assert
(
bo
->
state
==
BOS_FAILED
);
break
;
case
BS_CHUNKED
:
VFP_Begin
(
bo
,
cl
);
bo
->
vfp
->
begin
(
bo
,
cl
>
0
?
cl
:
0
);
if
(
bo
->
state
==
BOS_FETCHING
)
cls
=
fetch_chunked
(
bo
,
htc
);
mklen
=
1
;
VFP_End
(
bo
);
if
(
bo
->
vfp
->
end
(
bo
))
assert
(
bo
->
state
==
BOS_FAILED
);
break
;
case
BS_EOF
:
VFP_Begin
(
bo
,
cl
);
bo
->
vfp
->
begin
(
bo
,
cl
>
0
?
cl
:
0
);
if
(
bo
->
state
==
BOS_FETCHING
)
fetch_eof
(
bo
,
htc
);
mklen
=
1
;
cls
=
1
;
VFP_End
(
bo
);
if
(
bo
->
vfp
->
end
(
bo
))
assert
(
bo
->
state
==
BOS_FAILED
);
break
;
case
BS_ERROR
:
cls
=
FetchError
(
bo
,
"error incompatible Transfer-Encoding"
);
...
...
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