From: robertc <> Date: Sat, 12 Oct 2002 19:08:09 +0000 (+0000) Subject: fix multi-part receipt of headers X-Git-Tag: SQUID_3_0_PRE1~677 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc7de9f3183425c25c95e3c5b57e8245c8be24ae;p=thirdparty%2Fsquid.git fix multi-part receipt of headers --- diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 6b2de7d0c4..bec786671c 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.14 2002/10/12 10:50:55 hno Exp $ + * $Id: client_side_reply.cc,v 1.15 2002/10/12 13:08:09 robertc Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1090,9 +1090,9 @@ clientAlwaysAllowResponse(http_status sline) * adds Squid specific entries */ static void -clientBuildReplyHeader(clientReplyContext *context, HttpReply * rep) +clientBuildReplyHeader(clientReplyContext * context, HttpReply * rep) { - clientHttpRequest * http = context->http; + clientHttpRequest *http = context->http; HttpHeader *hdr = &rep->header; int is_hit = logTypeIsATcpHit(http->logType); request_t *request = http->request; @@ -1208,7 +1208,7 @@ clientBuildReplyHeader(clientReplyContext *context, HttpReply * rep) static HttpReply * -clientBuildReply(clientReplyContext *context, const char *buf, size_t size) +clientBuildReply(clientReplyContext * context, const char *buf, size_t size) { HttpReply *rep = httpReplyCreate(); size_t k = headersEnd(buf, size); @@ -1226,9 +1226,9 @@ clientBuildReply(clientReplyContext *context, const char *buf, size_t size) } static log_type -clientIdentifyStoreObject(clientReplyContext *context) +clientIdentifyStoreObject(clientReplyContext * context) { - clientHttpRequest * http = context->http; + clientHttpRequest *http = context->http; request_t *r = http->request; StoreEntry *e; if (r->flags.cachable || r->flags.internal) @@ -1416,18 +1416,18 @@ clientSendMoreData(void *data, StoreIOBuffer result) */ assert(context->reqofs == 0 || context->flags.storelogiccomplete); -#if THIS_DOES_NOT_WORK - /* XXX What is the purpose of this code? It overwrites the - * previous "packet" completely messing up header processing - * when headers are received in more than one chunk.. - */ - if (buf != result.data) { + if (context->flags.headersSent && buf != result.data) { /* we've got to copy some data */ assert(result.length <= next->readBuffer.length); xmemcpy(buf, result.data, result.length); body_buf = buf; + } else if (!context->flags.headersSent && + buf + context->reqofs != result.data) { + /* we've got to copy some data */ + assert(result.length + context->reqofs <= next->readBuffer.length); + xmemcpy(buf + context->reqofs, result.data, result.length); + body_buf = buf; } -#endif /* We've got the final data to start pushing... */ context->flags.storelogiccomplete = 1;