From: wessels <> Date: Sat, 18 Feb 2006 03:59:31 +0000 (+0000) Subject: Moved some common code into the ClientHttpRequest constructor. X-Git-Tag: SQUID_3_0_PRE4~330 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a0355e9575f60061863b8e7818bfb896bd536599;p=thirdparty%2Fsquid.git Moved some common code into the ClientHttpRequest constructor. --- diff --git a/src/client_side.cc b/src/client_side.cc index ae1a852171..5781554b33 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.710 2006/02/17 18:10:59 wessels Exp $ + * $Id: client_side.cc,v 1.711 2006/02/17 20:59:31 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1584,8 +1584,7 @@ parseHttpRequestAbort(ConnStateData::Pointer & conn, const char *uri) ClientHttpRequest *http; ClientSocketContext *context; StoreIOBuffer tempBuffer; - http = new ClientHttpRequest; - http->setConn(conn); + http = new ClientHttpRequest(conn); http->req_sz = conn->in.notYetUsed; http->uri = xstrdup(uri); setLogUri (http, uri); @@ -1595,7 +1594,6 @@ parseHttpRequestAbort(ConnStateData::Pointer & conn, const char *uri) clientStreamInit(&http->client_stream, clientGetMoreData, clientReplyDetach, clientReplyStatus, new clientReplyContext(http), clientSocketRecipient, clientSocketDetach, context, tempBuffer); - dlinkAdd(http, &http->active, &ClientActiveRequests); return context; } @@ -1963,9 +1961,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p, assert(prefix_sz <= conn->in.notYetUsed); /* Ok, all headers are received */ - http = new ClientHttpRequest; - - http->setConn(conn); + http = new ClientHttpRequest(conn); http->req_sz = prefix_sz; @@ -1989,8 +1985,6 @@ parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p, *(*prefix_p + prefix_sz) = '\0'; - dlinkAdd(http, &http->active, &ClientActiveRequests); - debug(33, 5) ("parseHttpRequest: Request Header is\n%s\n", (*prefix_p) + *req_line_sz_p); diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 934dcd8ead..e5af15269c 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.57 2006/02/17 18:10:59 wessels Exp $ + * $Id: client_side_request.cc,v 1.58 2006/02/17 20:59:31 wessels Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -141,10 +141,11 @@ ClientHttpRequest::operator delete (void *address) cbdataFree(t); } -ClientHttpRequest::ClientHttpRequest() : loggingEntry_(NULL) +ClientHttpRequest::ClientHttpRequest(ConnStateData::Pointer aConn) : loggingEntry_(NULL) { - /* reset range iterator */ start = current_time; + setConn(aConn); + dlinkAdd(this, &active, &ClientActiveRequests); } /* @@ -273,10 +274,9 @@ clientBeginRequest(method_t method, char const *url, CSCB * streamcallback, { size_t url_sz; HttpVersion http_ver (1, 0); - ClientHttpRequest *http = new ClientHttpRequest; + ClientHttpRequest *http = new ClientHttpRequest(NULL); HttpRequest *request; StoreIOBuffer tempBuffer; - http->setConn(NULL); http->start = current_time; /* this is only used to adjust the connection offset in client_side.c */ http->req_sz = 0; @@ -287,7 +287,6 @@ clientBeginRequest(method_t method, char const *url, CSCB * streamcallback, clientReplyStatus, new clientReplyContext(http), streamcallback, streamdetach, streamdata, tempBuffer); /* make it visible in the 'current acctive requests list' */ - dlinkAdd(http, &http->active, &ClientActiveRequests); /* Set flags */ /* internal requests only makes sense in an * accelerator today. TODO: accept flags ? */ diff --git a/src/client_side_request.h b/src/client_side_request.h index a0b5393d2e..880da73eed 100644 --- a/src/client_side_request.h +++ b/src/client_side_request.h @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.h,v 1.22 2005/11/21 23:26:45 wessels Exp $ + * $Id: client_side_request.h,v 1.23 2006/02/17 20:59:31 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -63,7 +63,7 @@ public: void *operator new (size_t); void operator delete (void *); - ClientHttpRequest(); + ClientHttpRequest(ConnStateData::Pointer); ~ClientHttpRequest(); /* Not implemented - present to prevent synthetic operations */ ClientHttpRequest(ClientHttpRequest const &);