[master] fb5cd02 minor polish

Poul-Henning Kamp phk at varnish-cache.org
Fri Sep 6 09:00:39 CEST 2013


commit fb5cd02860033e580315200ddebf2d950fec6ecb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Sep 5 14:08:49 2013 +0000

    minor polish

diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c
index 83c8953..0b47331 100644
--- a/bin/varnishd/cache/cache_http1_deliver.c
+++ b/bin/varnishd/cache/cache_http1_deliver.c
@@ -188,6 +188,7 @@ V1D_Deliver(struct req *req)
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 	CHECK_OBJ_NOTNULL(req->obj, OBJECT_MAGIC);
+	CHECK_OBJ_NOTNULL(req->obj->objcore, OBJCORE_MAGIC);
 
 	while (req->obj->objcore->busyobj)
 		(void)usleep(10000);
@@ -221,7 +222,8 @@ V1D_Deliver(struct req *req)
 	    !RFC2616_Req_Gzip(req->http)) {
 		/*
 		 * We don't know what it uncompresses to
-		 * XXX: we could cache that
+		 * XXX: we could cache that, but would still deliver
+		 * XXX: with multiple writes because of the gunzip buffer
 		 */
 		req->res_mode &= ~RES_LEN;
 		req->res_mode |= RES_GUNZIP;
@@ -246,8 +248,7 @@ V1D_Deliver(struct req *req)
 	if (req->res_mode & RES_GUNZIP)
 		http_Unset(req->resp, H_Content_Encoding);
 
-	if (req->obj->objcore != NULL
-	    && !(req->obj->objcore->flags & OC_F_PASS)
+	if (!(req->obj->objcore->flags & OC_F_PASS)
 	    && req->obj->response == 200
 	    && req->http->conds && RFC2616_Do_Cond(req)) {
 		req->wantbody = 0;
@@ -256,14 +257,15 @@ V1D_Deliver(struct req *req)
 	} else if (req->res_mode & RES_CHUNKED)
 		http_SetHeader(req->resp, "Transfer-Encoding: chunked");
 
-	http_PrintfHeader(req->resp, "Connection: %s",
-	    req->doclose ? "close" : "keep-alive");
+	http_SetHeader(req->resp,
+	    req->doclose ? "Connection: close" : "Connection: keep-alive");
 
 	/*
 	 * If nothing special planned, we can attempt Range support
 	 */
 	low = 0;
 	high = req->obj->len - 1;
+
 	if (
 	    req->wantbody &&
 	    (req->res_mode & RES_LEN) &&
@@ -279,8 +281,7 @@ V1D_Deliver(struct req *req)
 	 * Send HTTP protocol header, unless interior ESI object
 	 */
 	if (!(req->res_mode & RES_ESI_CHILD))
-		req->acct_req.hdrbytes +=
-		    HTTP1_Write(req->wrk, req->resp, 1);
+		req->acct_req.hdrbytes += HTTP1_Write(req->wrk, req->resp, 1);
 
 	if (!req->wantbody)
 		req->res_mode &= ~RES_CHUNKED;



More information about the varnish-commit mailing list