]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2110 fix: When Squid is shutting down, disable persistent connections
authorrousskov <>
Tue, 22 Jan 2008 23:45:45 +0000 (23:45 +0000)
committerrousskov <>
Tue, 22 Jan 2008 23:45:45 +0000 (23:45 +0000)
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

index 280b369a8da917b841e92f38b066885379e99314..13de32f3c1e75f4cbc5c99d3d2d209f15032a574 100644 (file)
@@ -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);