--------------------- PatchSet 11603 Date: 2007/08/31 13:47:42 Author: hno Branch: SQUID_2_6 Tag: (none) Log: MFC: Bug #2050: Persistent connection dropped if cache has no Content-Length Squid adds a Content-Length header to cache hits which originally did not have a Content-Length, but the keep-alive logics did not realize this and closed the connection regardless. Merged changes: 2007/08/24 14:54:05 hno +4 -5 Bug #2050: Persistent connection dropped if cache has no Content-Length Members: src/client_side.c:1.693.2.16->1.693.2.17 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid/squid/src/client_side.c,v retrieving revision 1.693.2.16 retrieving revision 1.693.2.17 diff -u -r1.693.2.16 -r1.693.2.17 --- squid/src/client_side.c 31 Aug 2007 13:45:12 -0000 1.693.2.16 +++ squid/src/client_side.c 31 Aug 2007 13:47:42 -0000 1.693.2.17 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.693.2.16 2007/08/31 13:45:12 hno Exp $ + * $Id: client_side.c,v 1.693.2.17 2007/08/31 13:47:42 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1839,6 +1839,7 @@ assert(actual_clen >= 0); httpHeaderDelById(hdr, HDR_CONTENT_LENGTH); httpHeaderPutSize(hdr, HDR_CONTENT_LENGTH, actual_clen); + rep->content_length = actual_clen; debug(33, 3) ("clientBuildRangeHeader: actual content length: %" PRINTF_OFF_T "\n", actual_clen); } } @@ -2845,6 +2846,7 @@ if (content_length >= 0) { httpHeaderPutSize(&state->http->reply->header, HDR_CONTENT_LENGTH, content_length); } + http->reply->content_length = content_length; } clientCheckHeaderDone(state); } @@ -3109,10 +3111,7 @@ } else if ((done = clientCheckTransferDone(http)) != 0 || size == 0) { debug(33, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd); /* We're finished case */ - if (httpReplyBodySize(http->request->method, entry->mem_obj->reply) < 0) { - debug(33, 5) ("clientWriteComplete: closing, content_length < 0\n"); - comm_close(fd); - } else if (!done) { + if (!done) { debug(33, 5) ("clientWriteComplete: closing, !done\n"); comm_close(fd); } else if (clientGotNotEnough(http)) {