From: Amos Jeffries Date: Mon, 9 May 2011 06:40:03 +0000 (+1200) Subject: Link HttpRequest with ConnStateData early X-Git-Tag: take07~16^2~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9174ba3dfe4c871b00d6ded40b41371b4cdf8809;p=thirdparty%2Fsquid.git Link HttpRequest with ConnStateData early --- diff --git a/src/client_side.cc b/src/client_side.cc index cb1a3fc623..622237fffa 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2546,6 +2546,10 @@ clientProcessRequest(ConnStateData *conn, HttpParser *hp, ClientSocketContext *c request->myportname = conn->port->name; request->http_ver = http_ver; + // Link this HttpRequest to ConnStateData relatively early so the following complex handling can use it + // TODO: this effectively obsoletes a lot of conn->FOO copying. That needs cleaning up later. + request->clientConnectionManager = conn; + if (request->header.chunked()) { chunked = true; } else if (request->header.has(HDR_TRANSFER_ENCODING)) { diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 6ab8f70aa9..2680d1175f 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -268,8 +268,7 @@ clientReplyContext::processExpired() debugs(88, 5, "clientReplyContext::processExpired : lastmod " << entry->lastmod ); http->storeEntry(entry); assert(http->out.offset == 0); - - http->request->clientConnectionManager = http->getConn(); + assert(http->request->clientConnectionManager == http->getConn()); /* * A refcounted pointer so that FwdState stays around as long as @@ -660,7 +659,7 @@ clientReplyContext::processMiss() if (http->flags.internal) r->protocol = AnyP::PROTO_INTERNAL; - r->clientConnectionManager = http->getConn(); + assert(r->clientConnectionManager == http->getConn()); /** Start forwarding to get the new object from network */ FwdState::fwdStart(http->getConn() != NULL ? http->getConn()->fd : -1,