From: wessels <> Date: Sat, 17 Oct 1998 01:19:29 +0000 (+0000) Subject: we used to CLOSE persistent connections if the ENTRY_BAD_LENGTH bit X-Git-Tag: SQUID_3_0_PRE1~2568 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=809802661cda68884ab4840824d29d3f55a318b3;p=thirdparty%2Fsquid.git we used to CLOSE persistent connections if the ENTRY_BAD_LENGTH bit was set (because we didn't get exactly content-length bytes). But when we read TOO MUCH we can still handle this gracefully. Instead of closing on != condition, now we close on < condition. --- diff --git a/src/client_side.cc b/src/client_side.cc index 5ff9d09180..9324e93e86 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.414 1998/10/15 23:44:37 wessels Exp $ + * $Id: client_side.cc,v 1.415 1998/10/16 19:19:29 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -66,6 +66,7 @@ static PF connStateFree; static PF requestTimeout; static int CheckQuickAbort2(const clientHttpRequest *); static int clientCheckTransferDone(clientHttpRequest *); +static int clientGotNotEnough(clientHttpRequest *); static void CheckQuickAbort(clientHttpRequest *); static void checkFailureRatio(err_type, hier_code); static void clientProcessMiss(clientHttpRequest *); @@ -1599,8 +1600,8 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da } else if (!done) { debug(33, 5) ("clientWriteComplete: closing, !done\n"); comm_close(fd); - } else if (EBIT_TEST(entry->flags, ENTRY_BAD_LENGTH)) { - debug(33, 5) ("clientWriteComplete: closing, ENTRY_BAD_LENGTH\n"); + } else if (clientGotNotEnough(http)) { + debug(33, 5) ("clientWriteComplete: client didn't get all it expected\n"); comm_close(fd); } else if (http->request->flags.proxy_keepalive) { debug(33, 5) ("clientWriteComplete: FD %d Keeping Alive\n", fd); @@ -2529,6 +2530,17 @@ clientCheckTransferDone(clientHttpRequest * http) return 1; } +static int +clientGotNotEnough(clientHttpRequest * http) +{ + int cl = http->entry->mem_obj->reply->content_length; + int hs = http->entry->mem_obj->reply->hdr_sz; + assert(cl >= 0); + if (http->out.offset < cl + hs) + return 1; + return 0; +} + /* * This function is designed to serve a fairly specific purpose. * Occasionally our vBNS-connected caches can talk to each other, but not