From: rousskov <> Date: Tue, 22 Jan 2008 23:45:45 +0000 (+0000) Subject: Bug 2110 fix: When Squid is shutting down, disable persistent connections X-Git-Tag: BASIC_TPROXY4~163 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f529bb2003699de7af5c4be222854a6845fc6be6;p=thirdparty%2Fsquid.git 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. --- diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 280b369a8d..13de32f3c1 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.148 2008/01/20 08:54:28 amosjeffries Exp $ + * $Id: client_side_reply.cc,v 1.149 2008/01/22 16:45:45 rousskov Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1334,6 +1334,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; @@ -1352,6 +1355,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);