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
3a4edf1d
Commit
3a4edf1d
authored
Mar 27, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Centralize the updating of the fetch_obj->len field.
parent
c5a1c750
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
8 deletions
+21
-8
cache.h
bin/varnishd/cache/cache.h
+2
-0
cache_esi_fetch.c
bin/varnishd/cache/cache_esi_fetch.c
+3
-3
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+12
-1
cache_gzip.c
bin/varnishd/cache/cache_gzip.c
+4
-4
No files found.
bin/varnishd/cache/cache.h
View file @
3a4edf1d
...
...
@@ -216,6 +216,8 @@ struct dstat {
/* Fetch processors --------------------------------------------------*/
void
VFP_update_length
(
const
struct
busyobj
*
,
ssize_t
);
typedef
void
vfp_begin_f
(
struct
busyobj
*
,
size_t
);
typedef
int
vfp_bytes_f
(
struct
busyobj
*
,
struct
http_conn
*
,
ssize_t
);
typedef
int
vfp_end_f
(
struct
busyobj
*
);
...
...
bin/varnishd/cache/cache_esi_fetch.c
View file @
3a4edf1d
...
...
@@ -103,7 +103,7 @@ vfp_esi_bytes_uu(struct busyobj *bo, const struct vef_priv *vef,
return
(
wl
);
VEP_Parse
(
bo
,
(
const
char
*
)
st
->
ptr
+
st
->
len
,
wl
);
st
->
len
+=
wl
;
bo
->
fetch_obj
->
len
+=
wl
;
VFP_update_length
(
bo
,
wl
)
;
bytes
-=
wl
;
}
return
(
1
);
...
...
@@ -140,7 +140,7 @@ vfp_esi_bytes_gu(struct busyobj *bo, const struct vef_priv *vef,
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
xxxassert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
VEP_Parse
(
bo
,
dp
,
dl
);
bo
->
fetch_obj
->
len
+=
dl
;
VFP_update_length
(
bo
,
dl
)
;
}
return
(
1
);
}
...
...
@@ -217,7 +217,7 @@ vfp_vep_callback(struct busyobj *bo, ssize_t l, enum vgz_flag flg)
}
i
=
VGZ_Gzip
(
vef
->
vgz
,
&
dp
,
&
dl
,
flg
);
vef
->
tot
+=
dl
;
bo
->
fetch_obj
->
len
+=
dl
;
VFP_update_length
(
bo
,
dl
)
;
}
while
(
!
VGZ_IbufEmpty
(
vef
->
vgz
)
||
(
flg
!=
VGZ_NORMAL
&&
VGZ_ObufFull
(
vef
->
vgz
)));
assert
(
VGZ_IbufEmpty
(
vef
->
vgz
));
...
...
bin/varnishd/cache/cache_fetch.c
View file @
3a4edf1d
...
...
@@ -113,6 +113,17 @@ VFP_End(struct busyobj *bo)
assert
(
bo
->
state
==
BOS_FAILED
);
}
void
VFP_update_length
(
const
struct
busyobj
*
bo
,
ssize_t
l
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
fetch_obj
,
OBJECT_MAGIC
);
if
(
l
==
0
)
return
;
assert
(
l
>
0
);
bo
->
fetch_obj
->
len
+=
l
;
}
/*--------------------------------------------------------------------
* VFP_NOP
...
...
@@ -165,7 +176,7 @@ vfp_nop_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
if
(
wl
<=
0
)
return
(
wl
);
st
->
len
+=
wl
;
bo
->
fetch_obj
->
len
+=
wl
;
VFP_update_length
(
bo
,
wl
)
;
bytes
-=
wl
;
}
return
(
1
);
...
...
bin/varnishd/cache/cache_gzip.c
View file @
3a4edf1d
...
...
@@ -468,7 +468,7 @@ vfp_gunzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
i
=
VGZ_Gunzip
(
vg
,
&
dp
,
&
dl
);
if
(
i
!=
VGZ_OK
&&
i
!=
VGZ_END
)
return
(
FetchError
(
bo
,
"Gunzip data error"
));
bo
->
fetch_obj
->
len
+=
dl
;
VFP_update_length
(
bo
,
dl
)
;
}
assert
(
i
==
Z_OK
||
i
==
Z_STREAM_END
);
return
(
1
);
...
...
@@ -543,7 +543,7 @@ vfp_gzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
return
(
-
1
);
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
VGZ_NORMAL
);
assert
(
i
==
Z_OK
);
bo
->
fetch_obj
->
len
+=
dl
;
VFP_update_length
(
bo
,
dl
)
;
}
return
(
1
);
}
...
...
@@ -569,7 +569,7 @@ vfp_gzip_end(struct busyobj *bo)
if
(
VGZ_ObufStorage
(
bo
,
vg
))
return
(
-
1
);
i
=
VGZ_Gzip
(
vg
,
&
dp
,
&
dl
,
VGZ_FINISH
);
bo
->
fetch_obj
->
len
+=
dl
;
VFP_update_length
(
bo
,
dl
)
;
}
while
(
i
!=
Z_STREAM_END
);
VGZ_UpdateObj
(
vg
,
bo
->
fetch_obj
);
if
(
VGZ_Destroy
(
&
vg
)
!=
VGZ_END
)
...
...
@@ -627,7 +627,7 @@ vfp_testgzip_bytes(struct busyobj *bo, struct http_conn *htc, ssize_t bytes)
bytes
-=
wl
;
VGZ_Ibuf
(
vg
,
st
->
ptr
+
st
->
len
,
wl
);
st
->
len
+=
wl
;
bo
->
fetch_obj
->
len
+=
wl
;
VFP_update_length
(
bo
,
wl
)
;
while
(
!
VGZ_IbufEmpty
(
vg
))
{
VGZ_Obuf
(
vg
,
vg
->
m_buf
,
vg
->
m_sz
);
...
...
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