]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
"content-length: 0" is a valid reply header, so we must use -1 to indicate
authorwessels <>
Sat, 29 Nov 1997 15:03:17 +0000 (15:03 +0000)
committerwessels <>
Sat, 29 Nov 1997 15:03:17 +0000 (15:03 +0000)
a LACK of a content-length.

src/client_side.cc
src/comm.cc
src/http.cc
src/store.cc

index c1eb56d781ad55f2dd7f5fc95cc97d9154710bcc..db7f4e1f8df399cb26e3318e0ff5bb0a104bbe61 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.159 1997/11/28 08:04:39 wessels Exp $
+ * $Id: client_side.cc,v 1.160 1997/11/29 08:03:17 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -393,7 +393,7 @@ modifiedSince(StoreEntry * entry, request_t * request)
     if (entry->lastmod < 0)
        return 1;
     /* Find size of the object */
-    if (mem->reply->content_length)
+    if (mem->reply->content_length >= 0)
        object_length = mem->reply->content_length;
     else
        object_length = entry->object_len - mem->reply->hdr_sz;
@@ -974,7 +974,7 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da
        HTTPCacheInfo->proto_touchobject(HTTPCacheInfo,
            http->request->protocol,
            http->out.size);
-       if (http->entry->mem_obj->reply->content_length <= 0) {
+       if (http->entry->mem_obj->reply->content_length < 0) {
            comm_close(fd);
        } else if (EBIT_TEST(http->request->flags, REQ_PROXY_KEEPALIVE)) {
            debug(12, 5) ("clientWriteComplete: FD %d Keeping Alive\n", fd);
@@ -1777,7 +1777,7 @@ icpCheckTransferDone(clientHttpRequest * http)
            return 1;
     if ((mem = entry->mem_obj) == NULL)
        return 0;
-    if (mem->reply->content_length == 0)
+    if (mem->reply->content_length < 0)
        return 0;
     if (http->out.offset >= mem->reply->content_length + mem->reply->hdr_sz)
        return 1;
index 019a3c3600dea5fa3f067b8ab7387e8661b63394..4383948a699b92a08a98aa0e38e2033daada4e28 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.208 1997/11/28 23:48:07 wessels Exp $
+ * $Id: comm.cc,v 1.209 1997/11/29 08:03:18 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -353,7 +353,7 @@ commConnectCallback(ConnectStateData * cs, int status)
     commConnectFree(fd, cs);
     if (cbdataValid(data))
        callback(fd, status, data);
-    cbdataUnlock(cs->data);
+    cbdataUnlock(data);
 }
 
 static void
index 346677e70b8c31bb6f62e18d09e3676689fb8938..f2e15722e379907aab53a2922d841d0301e835fd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.223 1997/11/20 17:48:37 wessels Exp $
+ * $Id: http.cc,v 1.224 1997/11/29 08:03:19 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -585,7 +585,7 @@ httpPconnTransferDone(HttpStateData * httpState)
     /*
      * If there is no content-length, then we probably can't be persistent
      */
-    if (reply->content_length == 0)
+    if (reply->content_length < 0)
        return 0;
     /*
      * If there is a content_length, see if we've got all of it.  If so,
index c70268f15e43ecc75d65f02301d292436d48a5f1..085e2fdeb1513f8a6d1fd764ccb478233375df00 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.350 1997/11/28 23:48:26 wessels Exp $
+ * $Id: store.cc,v 1.351 1997/11/29 08:03:21 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -291,6 +291,7 @@ new_MemObject(const char *url, const char *log_url)
     mem->reply->date = -2;
     mem->reply->expires = -2;
     mem->reply->last_modified = -2;
+    mem->reply->content_length = -1;
     mem->url = xstrdup(url);
     mem->log_url = xstrdup(log_url);
     mem->swapout.fd = -1;
@@ -1824,13 +1825,13 @@ storeEntryValidLength(const StoreEntry * e)
     debug(20, 5) ("storeEntryValidLength:         hdr_sz = %d\n", hdr_sz);
     debug(20, 5) ("storeEntryValidLength: content_length = %d\n", content_length);
 
-    if (content_length == 0) {
-       debug(20, 5) ("storeEntryValidLength: Zero content length; assume valid; '%s'\n",
+    if (content_length < 0) {
+       debug(20, 5) ("storeEntryValidLength: Unspecified content length: %s\n",
            storeKeyText(e->key));
        return 1;
     }
     if (hdr_sz == 0) {
-       debug(20, 5) ("storeEntryValidLength: Zero header size; assume valid; '%s'\n",
+       debug(20, 5) ("storeEntryValidLength: Zero header size: %s\n",
            storeKeyText(e->key));
        return 1;
     }