]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
we used to CLOSE persistent connections if the ENTRY_BAD_LENGTH bit
authorwessels <>
Sat, 17 Oct 1998 01:19:29 +0000 (01:19 +0000)
committerwessels <>
Sat, 17 Oct 1998 01:19:29 +0000 (01:19 +0000)
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.

src/client_side.cc

index 5ff9d09180d670229aaa466b1eace4d08239c42e..9324e93e860020c5e870d1f670deb171ed3d553e 100644 (file)
@@ -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