From: wessels <> Date: Sat, 29 Nov 1997 15:03:17 +0000 (+0000) Subject: "content-length: 0" is a valid reply header, so we must use -1 to indicate X-Git-Tag: SQUID_3_0_PRE1~4455 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1790d392f74d0f239215a8ea7d763dca5c327fe9;p=thirdparty%2Fsquid.git "content-length: 0" is a valid reply header, so we must use -1 to indicate a LACK of a content-length. --- diff --git a/src/client_side.cc b/src/client_side.cc index c1eb56d781..db7f4e1f8d 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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; diff --git a/src/comm.cc b/src/comm.cc index 019a3c3600..4383948a69 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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 diff --git a/src/http.cc b/src/http.cc index 346677e70b..f2e15722e3 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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, diff --git a/src/store.cc b/src/store.cc index c70268f15e..085e2fdeb1 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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; }