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
b399a62f
Commit
b399a62f
authored
Mar 05, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a set of VFP method functions which can do various sanity asserts
for us in a single place.
parent
5cd69e08
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
13 deletions
+43
-13
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+0
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+43
-9
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+0
-3
No files found.
bin/varnishd/cache/cache_esi_fetch.c
View file @
b399a62f
...
...
@@ -346,7 +346,6 @@ vfp_esi_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
vef
=
bo
->
vef_priv
;
CHECK_OBJ_NOTNULL
(
vef
,
VEF_MAGIC
);
AZ
(
bo
->
fetch_failed
);
AN
(
bo
->
vep
);
assert
(
&
bo
->
htc
==
htc
);
if
(
bo
->
is_gzip
&&
bo
->
do_gunzip
)
...
...
bin/varnishd/cache/cache_fetch.c
View file @
b399a62f
...
...
@@ -72,6 +72,40 @@ 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
);
AZ
(
bo
->
fetch_failed
);
return
(
bo
->
vfp
->
bytes
(
bo
,
htc
,
sz
));
}
static
int
VFP_End
(
struct
busyobj
*
bo
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AN
(
bo
->
vfp
);
return
(
bo
->
vfp
->
end
(
bo
));
}
/*--------------------------------------------------------------------
* VFP_NOP
*
...
...
@@ -235,7 +269,7 @@ fetch_straight(struct busyobj *bo, struct http_conn *htc, ssize_t cl)
}
else
if
(
cl
==
0
)
return
(
0
);
i
=
bo
->
vfp
->
b
ytes
(
bo
,
htc
,
cl
);
i
=
VFP_B
ytes
(
bo
,
htc
,
cl
);
if
(
i
<=
0
)
return
(
FetchError
(
bo
,
"straight insufficient bytes"
));
return
(
0
);
...
...
@@ -292,7 +326,7 @@ fetch_chunked(struct busyobj *bo, struct http_conn *htc)
if
(
cl
<
0
)
return
(
FetchError
(
bo
,
"chunked header number syntax"
));
if
(
cl
>
0
&&
bo
->
vfp
->
b
ytes
(
bo
,
htc
,
cl
)
<=
0
)
if
(
cl
>
0
&&
VFP_B
ytes
(
bo
,
htc
,
cl
)
<=
0
)
return
(
-
1
);
i
=
HTC_Read
(
htc
,
buf
,
1
);
...
...
@@ -314,7 +348,7 @@ fetch_eof(struct busyobj *bo, struct http_conn *htc)
int
i
;
assert
(
bo
->
body_status
==
BS_EOF
);
i
=
bo
->
vfp
->
b
ytes
(
bo
,
htc
,
SSIZE_MAX
);
i
=
VFP_B
ytes
(
bo
,
htc
,
SSIZE_MAX
);
if
(
i
<
0
)
return
(
-
1
);
return
(
0
);
...
...
@@ -541,24 +575,24 @@ FetchBody(struct worker *wrk, struct busyobj *bo)
break
;
case
BS_LENGTH
:
cl
=
fetch_number
(
bo
->
h_content_length
,
10
);
bo
->
vfp
->
b
egin
(
bo
,
cl
>
0
?
cl
:
0
);
VFP_B
egin
(
bo
,
cl
>
0
?
cl
:
0
);
cls
=
fetch_straight
(
bo
,
htc
,
cl
);
mklen
=
1
;
if
(
bo
->
vfp
->
e
nd
(
bo
))
if
(
VFP_E
nd
(
bo
))
cls
=
-
1
;
break
;
case
BS_CHUNKED
:
bo
->
vfp
->
b
egin
(
bo
,
cl
);
VFP_B
egin
(
bo
,
cl
);
cls
=
fetch_chunked
(
bo
,
htc
);
mklen
=
1
;
if
(
bo
->
vfp
->
e
nd
(
bo
))
if
(
VFP_E
nd
(
bo
))
cls
=
-
1
;
break
;
case
BS_EOF
:
bo
->
vfp
->
b
egin
(
bo
,
cl
);
VFP_B
egin
(
bo
,
cl
);
cls
=
fetch_eof
(
bo
,
htc
);
mklen
=
1
;
if
(
bo
->
vfp
->
e
nd
(
bo
))
if
(
VFP_E
nd
(
bo
))
cls
=
-
1
;
break
;
case
BS_ERROR
:
...
...
bin/varnishd/cache/cache_gzip.c
View file @
b399a62f
...
...
@@ -448,7 +448,6 @@ vfp_gunzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
const
void
*
dp
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AZ
(
bo
->
fetch_failed
);
vg
=
bo
->
vgz_rx
;
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
AZ
(
vg
->
vz
.
avail_in
);
...
...
@@ -526,7 +525,6 @@ vfp_gzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
const
void
*
dp
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AZ
(
bo
->
fetch_failed
);
vg
=
bo
->
vgz_rx
;
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
AZ
(
vg
->
vz
.
avail_in
);
...
...
@@ -613,7 +611,6 @@ vfp_testgzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
struct
storage
*
st
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
AZ
(
bo
->
fetch_failed
);
vg
=
bo
->
vgz_rx
;
CHECK_OBJ_NOTNULL
(
vg
,
VGZ_MAGIC
);
AZ
(
vg
->
vz
.
avail_in
);
...
...
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