Mailing List Archive

[6.0] b90509232 Rename the obj flag OF_CHGGZIP to OF_CHGCE, for "changed Content-Encoding".
commit b90509232e5668aa79332749d0593718077f50ae
Author: Geoff Simmons <geoff@uplex.de>
Date: Mon Feb 18 14:41:42 2019 +0100

Rename the obj flag OF_CHGGZIP to OF_CHGCE, for "changed Content-Encoding".

And update the comment explaining what happens. This is to make it
apparent that a VFP has changed C-E in the stored object, so C-E
should not be changed by an IMS fetch, and a new ETag from IMS has
to be weakened. The flag is appropriate for use by any VFP that
needs to manipulate C-E this way (not just gzip).

Closes #2910

diff --git a/bin/varnishd/cache/cache_esi_fetch.c b/bin/varnishd/cache/cache_esi_fetch.c
index b1f993dbf..16ff6e749 100644
--- a/bin/varnishd/cache/cache_esi_fetch.c
+++ b/bin/varnishd/cache/cache_esi_fetch.c
@@ -163,7 +163,7 @@ vfp_esi_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
ALLOC_OBJ(vef, VEF_MAGIC);
if (vef == NULL)
return (VFP_ERROR);
- vc->obj_flags |= OF_GZIPED | OF_CHGGZIP | OF_ESIPROC;
+ vc->obj_flags |= OF_GZIPED | OF_CHGCE | OF_ESIPROC;
vef->vgz = VGZ_NewGzip(vc->wrk->vsl, "G F E");
vef->vep = VEP_Init(vc, vc->req, vfp_vep_callback, vef);
vef->ibuf_sz = cache_param->gzip_buffer;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index f7fd60424..92f6feb70 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -350,11 +350,12 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
if (bo->stale_oc != NULL &&
ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) {
AZ(bo->stale_oc->flags & (OC_F_HFM|OC_F_PRIVATE));
- if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) {
+ if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGCE)) {
/*
- * If we changed the gzip status of the object
- * the stored Content_Encoding controls we
- * must weaken any new ETag we get.
+ * If a VFP changed C-E in the stored
+ * object, then don't overwrite C-E from
+ * the IMS fetch, and we must weaken any
+ * new ETag we get.
*/
http_Unset(bo->beresp, H_Content_Encoding);
RFC2616_Weaken_Etag(bo->beresp);
diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c
index bfe2f6279..6483a6758 100644
--- a/bin/varnishd/cache/cache_gzip.c
+++ b/bin/varnishd/cache/cache_gzip.c
@@ -466,14 +466,14 @@ vfp_gzip_init(struct vfp_ctx *vc, struct vfp_entry *vfe)
if (http_GetHdr(vc->resp, H_Content_Encoding, NULL))
return (VFP_NULL);
vg = VGZ_NewGzip(vc->wrk->vsl, vfe->vfp->priv1);
- vc->obj_flags |= OF_GZIPED | OF_CHGGZIP;
+ vc->obj_flags |= OF_GZIPED | OF_CHGCE;
} else {
if (!http_HdrIs(vc->resp, H_Content_Encoding, "gzip"))
return (VFP_NULL);
if (vfe->vfp == &VFP_gunzip) {
vg = VGZ_NewGunzip(vc->wrk->vsl, vfe->vfp->priv1);
vc->obj_flags &= ~OF_GZIPED;
- vc->obj_flags |= OF_CHGGZIP;
+ vc->obj_flags |= OF_CHGCE;
} else {
vg = VGZ_NewTestGunzip(vc->wrk->vsl, vfe->vfp->priv1);
vc->obj_flags |= OF_GZIPED;
diff --git a/include/tbl/obj_attr.h b/include/tbl/obj_attr.h
index b0b6773e1..a695c1efa 100644
--- a/include/tbl/obj_attr.h
+++ b/include/tbl/obj_attr.h
@@ -55,7 +55,7 @@
#ifdef OBJ_FLAG
/* upper, lower, val */
OBJ_FLAG(GZIPED, gziped, (1<<1))
- OBJ_FLAG(CHGGZIP, chggzip, (1<<2))
+ OBJ_FLAG(CHGCE, chgce, (1<<2))
OBJ_FLAG(IMSCAND, imscand, (1<<3))
OBJ_FLAG(ESIPROC, esiproc, (1<<4))
#undef OBJ_FLAG
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit