]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: rousskov
authoramosjeffries <>
Tue, 26 Feb 2008 07:05:47 +0000 (07:05 +0000)
committeramosjeffries <>
Tue, 26 Feb 2008 07:05:47 +0000 (07:05 +0000)
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

index b7003ccce09a57b432e55e385f633a3e730c4958..fd1d1154834e3276cd8c7464dac76acf97a53ef6 100644 (file)
@@ -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);