From 9174ba3dfe4c871b00d6ded40b41371b4cdf8809 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 9 May 2011 18:40:03 +1200 Subject: [PATCH] Link HttpRequest with ConnStateData early --- src/client_side.cc | 4 ++++ src/client_side_reply.cc | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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, -- 2.47.2