[master] 79cfb9c Mark objects with a "gziped" bit if they are.
Poul-Henning Kamp
phk at project.varnish-software.com
Sat Jan 22 14:01:53 CET 2011
commit 79cfb9cbf462a8c7ec5b544e54431ca82ad1d4c8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sat Jan 22 13:01:31 2011 +0000
Mark objects with a "gziped" bit if they are.
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 0d6b63f..3ea26ca 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -430,7 +430,9 @@ struct object {
double ban_t;
unsigned response;
+ /* XXX: make bitmap */
unsigned cacheable;
+ unsigned gziped;
ssize_t len;
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index b55b903..99e5d81 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -179,8 +179,7 @@ cnt_deliver(struct sess *sp)
sp->wrk->res_mode |= RES_ESI_CHILD;
}
- if (params->http_gzip_support &&
- http_HdrIs(sp->obj->http, H_Content_Encoding, "gzip") &&
+ if (params->http_gzip_support && sp->obj->gziped &&
!RFC2616_Req_Gzip(sp)) {
/*
* We don't know what it uncompresses to
@@ -662,6 +661,7 @@ cnt_fetch(struct sess *sp)
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
sp->wrk->storage_hint = NULL;
+ sp->obj->gziped = sp->wrk->is_gzip;
if (vary != NULL) {
sp->obj->vary =
diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index e8ccdc8..fe802f1 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -269,6 +269,7 @@ vfp_esi_bytes_gg(struct sess *sp, struct http_conn *htc, size_t bytes)
do {
VGZ_Obuf(sp->wrk->vgz_rx, ibuf2, sizeof ibuf2);
i = VGZ_Gunzip(sp->wrk->vgz_rx, &dp, &dl);
+ /* XXX: check i */
vef->bufp = ibuf2;
if (dl > 0)
VEP_parse(sp, ibuf2, dl);
@@ -373,6 +374,9 @@ vfp_esi_end(struct sess *sp)
sp->wrk->vef_priv = NULL;
CHECK_OBJ_NOTNULL(vef, VEF_MAGIC);
XXXAZ(vef->error);
+ sp->obj->gziped = 1;
+ } else {
+ sp->obj->gziped = 0;
}
return (0);
}
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 747a41a..189b62e 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -383,6 +383,7 @@ vfp_gunzip_end(struct sess *sp)
vg = sp->wrk->vgz_rx;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
VGZ_Destroy(&vg);
+ sp->obj->gziped = 0;
return (0);
}
@@ -458,6 +459,7 @@ vfp_gzip_end(struct sess *sp)
sp->obj->len += dl;
} while (i != Z_STREAM_END);
VGZ_Destroy(&vg);
+ sp->obj->gziped = 1;
return (0);
}
More information about the varnish-commit
mailing list