From: wessels <> Date: Sat, 3 Jan 1998 12:27:17 +0000 (+0000) Subject: We were erroneously assuming that non-200 replies would have a content-length X-Git-Tag: SQUID_3_0_PRE1~4269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3c60429a20c2f22a7ad5191622d121cece06526;p=thirdparty%2Fsquid.git We were erroneously assuming that non-200 replies would have a content-length if there were a reply body. RFC 2068 does not require this. If there is no content-length, then we can't have a persistent connection. --- diff --git a/src/client_side.cc b/src/client_side.cc index 8c98f50650..519577454e 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.187 1998/01/02 18:09:20 wessels Exp $ + * $Id: client_side.cc,v 1.188 1998/01/03 05:27:17 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1887,12 +1887,12 @@ clientCheckTransferDone(clientHttpRequest * http) return 0; /* haven't found end of headers yet */ else if (reply->code == HTTP_OK) sending = SENDING_BODY; - else if (reply->content_length < 0) - sending = SENDING_HDRSONLY; else if (reply->code == HTTP_NO_CONTENT) sending = SENDING_HDRSONLY; else if (reply->code == HTTP_NOT_MODIFIED) sending = SENDING_HDRSONLY; + else if (reply->code < HTTP_OK) + sending = SENDING_HDRSONLY; else if (http->request->method == METHOD_HEAD) sending = SENDING_HDRSONLY; else diff --git a/src/http.cc b/src/http.cc index 8973e7ff14..41428db3f3 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.230 1997/12/07 00:48:14 wessels Exp $ + * $Id: http.cc,v 1.231 1998/01/03 05:27:18 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -584,26 +584,26 @@ httpPconnTransferDone(HttpStateData * httpState) * - If we haven't seen the end of the reply headers, we can't * be persistent. * - For "200 OK" check the content-length in the next block. - * - For other replies without a content-length, we're done. * - For "204 No Content" (even with content-length) we're done. * - For "304 Not Modified" (even with content-length) we're done. + * - 1XX replies never have a body; we're done. * - For HEAD requests with content-length we're done. - * - For other replies with a content length, we continue... + * - For all other replies, check content length in next block. */ if (httpState->reply_hdr_state < 2) return 0; else if (reply->code == HTTP_OK) - (void) 0; /* continue */ - else if (reply->content_length < 0) - return 1; + (void) 0; /* common case, continue */ else if (reply->code == HTTP_NO_CONTENT) return 1; else if (reply->code == HTTP_NOT_MODIFIED) return 1; + else if (reply->code < HTTP_OK) + return 1; else if (httpState->request->method == METHOD_HEAD) return 1; /* - * If there is no content-length, then we probably can't be + * If there is no content-length, then we can't be * persistent. If there is a content length, then we must * wait until we've seen the end of the body. */