From: Eduard Bagdasaryan Date: Tue, 10 May 2016 23:06:48 +0000 (-0600) Subject: Allow chunking the last HTTP response on a connection. X-Git-Tag: SQUID_4_0_11~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95172eeabc696cfce37486f72f6e0de0fecb189d;p=thirdparty%2Fsquid.git Allow chunking the last HTTP response on a connection. Squid should avoid signaling the message end by connection closure because it hurts message integrity and sometimes performance. Squid now chunks if: 1. the response has a body; 2. the client claims HTTP/1.1 support; and 3. Squid is not going to send a Content-Length header. AFAICT, Squid used to exclude to-be-closed connections from chunking because chunking support was added (trunk r10781) specifically to optimize persistent connection reuse and closing connections were incorrectly excluded as a non-interesting/out-of-scope case. And/or perhaps we did not realize the dangers of signaling the message end by connection closure. --- diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 5cd5e4564c..76d7ace9f5 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1532,9 +1532,7 @@ clientReplyContext::buildReplyHeader() } // Decide if we send chunked reply - if (maySendChunkedReply && - request->flags.proxyKeepalive && - reply->bodySize(request->method) < 0) { + if (maySendChunkedReply && reply->bodySize(request->method) < 0) { debugs(88, 3, "clientBuildReplyHeader: chunked reply"); request->flags.chunkedReply = true; hdr->putStr(Http::HdrType::TRANSFER_ENCODING, "chunked");