squid-2.HEAD: proposed patch for non-broken keep-alive case

From: Alexander V. Lukyanov <lav@dont-contact.us>
Date: Sun, 27 Apr 2008 14:06:28 +0400

Hello!

It seems that squid currently considers broken the case of keep-alive when
there is no Content-Length and the transfer encoding is chunked.
I think it is not quite correct, as chunked encoding allows to determine
reply body end.

Here is an example:
2008/04/27 08:48:51| httpProcessReplyHeader: Impossible keep-alive header from 'http://www.update.microsoft.com/v6/UpdateRegulationService/UpdateRegulation.asmx'
2008/04/27 08:48:51| GOT HTTP REPLY HDR:
---------
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Connection: keep-alive
Date: Sun, 27 Apr 2008 04:48:51 GMT
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Encoding: xpress
Vary: Accept-Encoding
Transfer-Encoding: chunked

----------

Here is a patch.

Index: http.c
===================================================================
RCS file: /squid/squid/src/http.c,v
retrieving revision 1.441
diff -u -p -r1.441 http.c
--- http.c 25 Apr 2008 20:39:36 -0000 1.441
+++ http.c 27 Apr 2008 04:59:52 -0000
@@ -574,7 +574,9 @@ httpProcessReplyHeader(HttpStateData * h
     if (reply->keep_alive) {
         if (httpState->peer)
             httpState->peer->stats.n_keepalives_recv++;
- if (Config.onoff.detect_broken_server_pconns && httpReplyBodySize(httpState->request->method, reply) == -1) {
+ if (Config.onoff.detect_broken_server_pconns
+ && httpReplyBodySize(httpState->request->method, reply) == -1
+ && !httpState->flags.chunked) {
             debug(11, 1) ("httpProcessReplyHeader: Impossible keep-alive header from '%s'\n", storeUrl(entry));
             debug(11, 2) ("GOT HTTP REPLY HDR:\n---------\n%s\n----------\n",
                 httpState->reply_hdr.buf);
Received on Sun Apr 27 2008 - 10:23:32 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT