[master] 95e9092 Incrementally chip away at struct object

Poul-Henning Kamp phk at FreeBSD.org
Mon Aug 11 10:48:16 CEST 2014


commit 95e9092eff6f4d9e306ddb6d2955554b1828cf9e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 11 08:48:01 2014 +0000

    Incrementally chip away at struct object

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index d8ebfc6..d22d1db 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -159,7 +159,8 @@ vbf_beresp2obj(struct busyobj *bo)
 	obj->oa_http = HTTP_Encode(bo->beresp, bo->ws_o,
 	    bo->uncacheable ? HTTPH_R_PASS : HTTPH_A_INS);
 	AN(obj->oa_http);
-	AZ(HTTP_Decode(obj->http, obj->oa_http));
+	AZ(HTTP_Decode(obj->http,
+	    ObjGetattr(bo->fetch_objcore, bo->stats, OA_HEADERS, NULL)));
 
 	if (http_GetHdr(bo->beresp, H_Last_Modified, &b))
 		AZ(ObjSetDouble(bo->fetch_objcore, bo->stats, OA_LASTMODIFIED,
diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index 2a2b1bc..e3b392a 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -92,7 +92,7 @@ v1d_dorange(struct req *req, struct busyobj *bo, const char *r)
 	ssize_t len, low, high, has_low;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
+	CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC);
 	assert(http_IsStatus(req->resp, 200));
 
 	/* We must snapshot the length if we're streaming from the backend */
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index f8da916..f249d7b 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -236,6 +236,9 @@ ObjGetattr(struct objcore *oc, struct dstat *ds, enum obj_attr attr,
 	case OA_GZIPBITS:
 		*len = sizeof o->oa_gzipbits;
 		return (o->oa_gzipbits);
+	case OA_HEADERS:
+		*len = 0;			// XXX: hack
+		return (o->oa_http);
 	case OA_LASTMODIFIED:
 		*len = sizeof o->oa_lastmodified;
 		return (o->oa_lastmodified);
@@ -256,6 +259,7 @@ ObjSetattr(struct objcore *oc, struct dstat *ds, enum obj_attr attr,
     ssize_t len)
 {
 	struct object *o;
+
 	CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
 	AN(ds);
 	o = ObjGetObj(oc, ds);
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index 751c0a3..3ab1b9c 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -187,7 +187,6 @@ stv_alloc_obj(const struct vfp_ctx *vc, size_t size)
 	struct storage *st = NULL;
 	struct stevedore *stv;
 	unsigned fail;
-	struct object *obj;
 
 	/*
 	 * Always use the stevedore which allocated the object in order to
@@ -196,9 +195,7 @@ stv_alloc_obj(const struct vfp_ctx *vc, size_t size)
 	CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
 	CHECK_OBJ_NOTNULL(vc->bo, BUSYOBJ_MAGIC);
 	AN(vc->bo->stats);
-	obj = vc->bo->fetch_obj;
-	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
-	stv = obj->body->stevedore;
+	stv = vc->body->stevedore;
 	CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
 
 	if (size > cache_param->fetch_maxchunksize)



More information about the varnish-commit mailing list