From 11f5d65b45dd20aef3d7c6e98ad72ea08e617718 Mon Sep 17 00:00:00 2001 From: amosjeffries <> Date: Tue, 26 Feb 2008 07:05:47 +0000 Subject: [PATCH] Author: rousskov Bug 2110 fix: When Squid is shutting down, disable persistent connections in responses. This change should discourage clients from sending us more requests. It should only affect hit responses because misses are denied during shutdown. --- src/client_side_reply.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index b7003ccce0..fd1d115483 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.144.2.2 2008/02/24 11:43:27 amosjeffries Exp $ + * $Id: client_side_reply.cc,v 1.144.2.3 2008/02/26 00:05:47 amosjeffries Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1314,6 +1314,9 @@ clientReplyContext::buildReplyHeader() #endif + /* Check whether we should send keep-alive */ + // TODO: disable proxy_keepalive only once + if (reply->bodySize(request->method) < 0) { debugs(88, 3, "clientBuildReplyHeader: can't keep-alive, unknown body size" ); request->flags.proxy_keepalive = 0; @@ -1332,6 +1335,11 @@ clientReplyContext::buildReplyHeader() if (!Config.onoff.client_pconns && !request->flags.must_keepalive) request->flags.proxy_keepalive = 0; + if (request->flags.proxy_keepalive && shutting_down) { + debugs(88, 3, "clientBuildReplyHeader: Shutting down, don't keep-alive."); + request->flags.proxy_keepalive = 0; + } + /* Append VIA */ if (Config.onoff.via) { LOCAL_ARRAY(char, bbuf, MAX_URL + 32); -- 2.47.2