[master] 31741b8 Set the OA_VARY through the API.

Poul-Henning Kamp phk at FreeBSD.org
Mon Aug 18 13:36:19 CEST 2014


commit 31741b8417daef395f0e899c63cf048730568cf8
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 18 11:35:50 2014 +0000

    Set the OA_VARY through the API.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 8d718fa..42c40d3 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -563,7 +563,7 @@ struct object {
 	struct storage		*objstore;
 	struct objcore		*objcore;
 
-	uint8_t			*vary;
+	uint8_t			*oa_vary;
 
 	uint8_t			*oa_http;
 
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 19c9bf6..29db641 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -140,10 +140,9 @@ vbf_beresp2obj(struct busyobj *bo)
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
 
 	if (vary != NULL) {
-		obj->vary = (void *)WS_Copy(obj->http->ws,
-		    VSB_data(vary), varyl);
-		AN(obj->vary);
-		(void)VRY_Validate(obj->vary);
+		b = ObjSetattr(bo->vfc, OA_VARY, varyl);
+		memcpy(b, VSB_data(vary), varyl);
+		(void)VRY_Validate(obj->oa_vary);
 		VSB_delete(vary);
 	}
 
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index c66a343..ca028bc 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -275,7 +275,7 @@ ObjGetattr(struct objcore *oc, struct dstat *ds, enum obj_attr attr,
 		return (o->oa_lastmodified);
 	case OA_VARY:
 		*len = 4;			// XXX: hack
-		return (o->vary);
+		return (o->oa_vary);
 	case OA_VXID:
 		*len = sizeof o->oa_vxid;
 		return (o->oa_vxid);
@@ -312,6 +312,10 @@ ObjSetattr(const struct vfp_ctx *vc, enum obj_attr attr,
 	case OA_LASTMODIFIED:
 		assert(len == sizeof o->oa_lastmodified);
 		return (o->oa_lastmodified);
+	case OA_VARY:
+		o->oa_vary = (void*)WS_Alloc(o->http->ws, len);
+		AN(o->oa_vary);
+		return (o->oa_vary);
 	case OA_VXID:
 		assert(len == sizeof o->oa_vxid);
 		return (o->oa_vxid);



More information about the varnish-commit mailing list