[master] 06c9beb Concentrate the "Connection: close" logic in http1

Poul-Henning Kamp phk at FreeBSD.org
Fri Feb 12 23:30:33 CET 2016


commit 06c9beb0ef36fdebbea99f94388aa8da6610b2f2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Feb 12 22:29:54 2016 +0000

    Concentrate the "Connection: close" logic in http1

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 22150d1..25f4e33 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -299,9 +299,6 @@ cnt_transmit(struct worker *wrk, struct req *req)
 
 	VSLb_ts_req(req, "Resp", W_TIM_real(wrk));
 
-	if (http_HdrIs(req->resp, H_Connection, "close"))
-		req->doclose = SC_RESP_CLOSE;
-
 	if (req->objcore->flags & (OC_F_PRIVATE | OC_F_PASS)) {
 		if (boc != NULL) {
 			HSH_Abandon(req->objcore);
diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c
index 7885ad2..3af9f48 100644
--- a/bin/varnishd/http1/cache_http1_deliver.c
+++ b/bin/varnishd/http1/cache_http1_deliver.c
@@ -101,7 +101,9 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
 
 	VSLb(req->vsl, SLT_Debug, "RES_MODE %x", req->res_mode);
 
-	if (req->doclose) {
+	if (!req->doclose && http_HdrIs(req->resp, H_Connection, "close")) {
+		req->doclose = SC_RESP_CLOSE;
+	} else if (req->doclose) {
 		if (!http_HdrIs(req->resp, H_Connection, "close")) {
 			http_Unset(req->resp, H_Connection);
 			http_SetHeader(req->resp, "Connection: close");



More information about the varnish-commit mailing list