[master] 5aec889 Don't bother with any of the beresp.body transformations (esi/gzip/gunzip) if we know the length to be zero.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Sep 30 11:09:41 CEST 2014
commit 5aec8898c71b7cb8b18093af99733e4199d18e10
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Sep 30 09:07:57 2014 +0000
Don't bother with any of the beresp.body transformations (esi/gzip/gunzip)
if we know the length to be zero.
This is inspired by ticket #1590, even though I can't seem to see what
Varnish does wrong in that case to begin with.
Fixes #1590
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 8ac532a..030c1bb 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -547,16 +547,18 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (bo->do_gunzip || (bo->is_gzip && bo->do_esi))
(void)VFP_Push(bo->vfc, &vfp_gunzip, 1);
- if (bo->do_esi && bo->do_gzip) {
- (void)VFP_Push(bo->vfc, &vfp_esi_gzip, 1);
- } else if (bo->do_esi && bo->is_gzip && !bo->do_gunzip) {
- (void)VFP_Push(bo->vfc, &vfp_esi_gzip, 1);
- } else if (bo->do_esi) {
- (void)VFP_Push(bo->vfc, &vfp_esi, 1);
- } else if (bo->do_gzip) {
- (void)VFP_Push(bo->vfc, &vfp_gzip, 1);
- } else if (bo->is_gzip && !bo->do_gunzip) {
- (void)VFP_Push(bo->vfc, &vfp_testgunzip, 1);
+ if (bo->htc->content_length != 0) {
+ if (bo->do_esi && bo->do_gzip) {
+ (void)VFP_Push(bo->vfc, &vfp_esi_gzip, 1);
+ } else if (bo->do_esi && bo->is_gzip && !bo->do_gunzip) {
+ (void)VFP_Push(bo->vfc, &vfp_esi_gzip, 1);
+ } else if (bo->do_esi) {
+ (void)VFP_Push(bo->vfc, &vfp_esi, 1);
+ } else if (bo->do_gzip) {
+ (void)VFP_Push(bo->vfc, &vfp_gzip, 1);
+ } else if (bo->is_gzip && !bo->do_gunzip) {
+ (void)VFP_Push(bo->vfc, &vfp_testgunzip, 1);
+ }
}
if (bo->fetch_objcore->flags & OC_F_PRIVATE)
More information about the varnish-commit
mailing list