[master] 128ca35 remove a couple of pointless copies of the HTTP status.

Poul-Henning Kamp phk at FreeBSD.org
Tue Feb 25 12:33:25 CET 2014


commit 128ca35f6a48b5bea340d9ad734dd7c5394dd8ce
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 19 08:35:05 2014 +0000

    remove a couple of pointless copies of the HTTP status.
    
    Pick it out of struct http when needed.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 7ab3a1a..623e5ba 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -524,7 +524,6 @@ struct busyobj {
 	int			retries;
 	unsigned		refcount;
 	double			t_fetch;
-	uint16_t		err_code;
 	struct req		*req;
 
 	uint8_t			*vary;
@@ -591,7 +590,6 @@ struct object {
 	struct objcore		*objcore;
 
 	uint8_t			*vary;
-	uint16_t		response;
 
 	/* XXX: make bitmap */
 	uint8_t			gziped;
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 661d802..4e4b229 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -142,7 +142,6 @@ vbf_bereq2obj(struct worker *wrk, struct busyobj *bo)
 	}
 
 	obj->vxid = bo->vsl->wid;
-	obj->response = bo->err_code;
 	WS_Assert(bo->ws_o);
 
 	/* Filter into object */
@@ -331,8 +330,6 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
 	 */
 	bo->htc.body_status = RFC2616_Body(bo, &wrk->stats);
 
-	bo->err_code = http_GetStatus(bo->beresp);
-
 	/*
 	 * What does RFC2616 think about TTL ?
 	 */
diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index 66982b2..2c681d6 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -93,7 +93,7 @@ v1d_dorange(struct req *req, const char *r)
 	ssize_t low, high, has_low;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	assert(req->obj->response == 200);
+	assert(http_GetStatus(req->obj->http) == 200);
 	if (strncmp(r, "bytes=", 6))
 		return;
 	r += 6;
@@ -271,7 +271,7 @@ V1D_Deliver(struct req *req)
 	    req->wantbody &&
 	    !(req->res_mode & (RES_ESI|RES_ESI_CHILD)) &&
 	    cache_param->http_range_support &&
-	    req->obj->response == 200) {
+	    http_GetStatus(req->obj->http) == 200) {
 		http_SetHeader(req->resp, "Accept-Ranges: bytes");
 		if (http_GetHdr(req->http, H_Range, &r))
 			v1d_dorange(req, r);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index b2f3ef0..cb78866 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -147,7 +147,7 @@ cnt_deliver(struct worker *wrk, struct req *req)
 
 	if (!(req->obj->objcore->flags & OC_F_PASS)
 	    && req->esi_level == 0
-	    && req->obj->response == 200
+	    && http_GetStatus(req->obj->http) == 200
 	    && req->http->conds && RFC2616_Do_Cond(req))
 		http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified");
 
@@ -304,7 +304,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
 
 	req->obj = oc_getobj(&wrk->stats, req->objcore);
 	req->objcore = NULL;
-	req->err_code = req->obj->response;
+	req->err_code = http_GetStatus(req->obj->http);
 	req->req_step = R_STP_DELIVER;
 	return (REQ_FSM_MORE);
 }



More information about the varnish-commit mailing list