Commit 54af42d4 authored by Geoff Simmons's avatar Geoff Simmons

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
parent ee51ce05
......@@ -162,7 +162,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;
......
......@@ -356,11 +356,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);
......
......@@ -465,14 +465,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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment