--------------------- PatchSet 6598 Date: 2008/01/21 21:24:37 Author: chtsanti Branch: async-calls Tag: (none) Log: Converting the ConnStateData related code in client_side.cc to use CommCalls: - The ConnStateData used a RefCount pointer (the openReference) to keep it self alive which is not compatible with the cbdata used by CommCalls. This patch make the ConnStateData non RefCountable class and use cbdata instead. I hope I am not adding new bugs here.... - The connReadWasError connFinishedWithConn clientMaybeReadData and clientAfter ReadingRequests static functions now are ConnStateData methods - The clientReadRequest, connStateClosed and requestTimeout functions are now Co nnStateData methods and modified for use with CommCalls. Members: src/ACLChecklist.cc:1.39.4.1->1.39.4.2 src/ACLChecklist.h:1.28.4.1->1.28.4.2 src/AuthUserRequest.cc:1.19.4.1->1.19.4.2 src/AuthUserRequest.h:1.8.20.1->1.8.20.2 src/client_side.cc:1.139.4.7->1.139.4.8 src/client_side.h:1.22.4.5->1.22.4.6 src/client_side_reply.cc:1.112.4.1->1.112.4.2 src/client_side_request.cc:1.79.4.7->1.79.4.8 src/client_side_request.cci:1.4->1.4.32.1 src/client_side_request.h:1.30.4.6->1.30.4.7 src/auth/basic/auth_basic.cc:1.28->1.28.4.1 src/auth/basic/auth_basic.h:1.13->1.13.4.1 src/auth/digest/auth_digest.cc:1.38.4.1->1.38.4.2 src/auth/digest/auth_digest.h:1.14->1.14.20.1 src/auth/negotiate/auth_negotiate.cc:1.25.4.1->1.25.4.2 src/auth/negotiate/auth_negotiate.h:1.9->1.9.4.1 src/auth/ntlm/auth_ntlm.cc:1.47.4.1->1.47.4.2 src/auth/ntlm/auth_ntlm.h:1.16->1.16.4.1 Index: squid3/src/ACLChecklist.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLChecklist.cc,v retrieving revision 1.39.4.1 retrieving revision 1.39.4.2 diff -u -r1.39.4.1 -r1.39.4.2 --- squid3/src/ACLChecklist.cc 29 Dec 2007 15:24:31 -0000 1.39.4.1 +++ squid3/src/ACLChecklist.cc 21 Jan 2008 21:24:37 -0000 1.39.4.2 @@ -1,5 +1,5 @@ /* - * $Id: ACLChecklist.cc,v 1.39.4.1 2007/12/29 15:24:31 chtsanti Exp $ + * $Id: ACLChecklist.cc,v 1.39.4.2 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -401,7 +401,7 @@ /* AYJ: It fails in builds without any Authentication configured */ assert(auth_user_request == NULL); - conn_ = NULL; + cbdataReferenceDone(conn_); cbdataReferenceDone(accessList); @@ -409,17 +409,17 @@ } -ConnStateData::Pointer +ConnStateData * ACLChecklist::conn() { return conn_; } void -ACLChecklist::conn(ConnStateData::Pointer aConn) +ACLChecklist::conn(ConnStateData *aConn) { assert (conn() == NULL); - conn_ = aConn; + conn_ = cbdataReference(aConn); } void Index: squid3/src/ACLChecklist.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLChecklist.h,v retrieving revision 1.28.4.1 retrieving revision 1.28.4.2 diff -u -r1.28.4.1 -r1.28.4.2 --- squid3/src/ACLChecklist.h 29 Dec 2007 15:24:31 -0000 1.28.4.1 +++ squid3/src/ACLChecklist.h 21 Jan 2008 21:24:37 -0000 1.28.4.2 @@ -1,6 +1,6 @@ /* - * $Id: ACLChecklist.h,v 1.28.4.1 2007/12/29 15:24:31 chtsanti Exp $ + * $Id: ACLChecklist.h,v 1.28.4.2 2008/01/21 21:24:37 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -97,8 +97,8 @@ void checkCallback(allow_t answer); void preCheck(); _SQUID_INLINE_ bool matchAclListFast(const ACLList * list); - ConnStateData::Pointer conn(); - void conn(ConnStateData::Pointer); + ConnStateData * conn(); + void conn(ConnStateData *); int authenticated(); bool asyncInProgress() const; @@ -143,7 +143,7 @@ void matchAclList(const ACLList * list, bool const fast); void matchAclListSlow(const ACLList * list); CBDATA_CLASS(ACLChecklist); - ConnStateData::Pointer conn_; /* hack for ident and NTLM */ + ConnStateData * conn_; /* hack for ident and NTLM */ bool async_; bool finished_; allow_t allow_; Index: squid3/src/AuthUserRequest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthUserRequest.cc,v retrieving revision 1.19.4.1 retrieving revision 1.19.4.2 diff -u -r1.19.4.1 -r1.19.4.2 --- squid3/src/AuthUserRequest.cc 29 Dec 2007 15:24:31 -0000 1.19.4.1 +++ squid3/src/AuthUserRequest.cc 21 Jan 2008 21:24:37 -0000 1.19.4.2 @@ -1,6 +1,6 @@ /* - * $Id: AuthUserRequest.cc,v 1.19.4.1 2007/12/29 15:24:31 chtsanti Exp $ + * $Id: AuthUserRequest.cc,v 1.19.4.2 2008/01/21 21:24:37 chtsanti Exp $ * * DO NOT MODIFY NEXT 2 LINES: * arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4 @@ -286,7 +286,7 @@ * This is basically a handle approach. */ static void -authenticateAuthenticateUser(AuthUserRequest * auth_user_request, HttpRequest * request, ConnStateData::Pointer &conn, http_hdr_type type) +authenticateAuthenticateUser(AuthUserRequest * auth_user_request, HttpRequest * request, ConnStateData * conn, http_hdr_type type) { assert(auth_user_request != NULL); @@ -294,7 +294,7 @@ } static AuthUserRequest * -authTryGetUser (AuthUserRequest **auth_user_request, ConnStateData::Pointer & conn, HttpRequest * request) +authTryGetUser (AuthUserRequest **auth_user_request, ConnStateData * conn, HttpRequest * request) { if (*auth_user_request) return *auth_user_request; @@ -329,7 +329,7 @@ */ auth_acl_t -AuthUserRequest::authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, IPAddress &src_addr) +AuthUserRequest::authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IPAddress &src_addr) { const char *proxy_auth; assert(headertype != 0); @@ -508,7 +508,7 @@ auth_acl_t -AuthUserRequest::tryToAuthenticateAndSetAuthUser(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, IPAddress &src_addr) +AuthUserRequest::tryToAuthenticateAndSetAuthUser(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IPAddress &src_addr) { /* If we have already been called, return the cached value */ AuthUserRequest *t = authTryGetUser (auth_user_request, conn, request); Index: squid3/src/AuthUserRequest.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AuthUserRequest.h,v retrieving revision 1.8.20.1 retrieving revision 1.8.20.2 diff -u -r1.8.20.1 -r1.8.20.2 --- squid3/src/AuthUserRequest.h 29 Dec 2007 15:24:31 -0000 1.8.20.1 +++ squid3/src/AuthUserRequest.h 21 Jan 2008 21:24:37 -0000 1.8.20.2 @@ -1,6 +1,6 @@ /* - * $Id: AuthUserRequest.h,v 1.8.20.1 2007/12/29 15:24:31 chtsanti Exp $ + * $Id: AuthUserRequest.h,v 1.8.20.2 2008/01/21 21:24:37 chtsanti Exp $ * * DO NOT MODIFY NEXT 2 LINES: * arch-tag: 674533af-8b21-4641-b71a-74c4639072a0 @@ -64,7 +64,7 @@ int direction(); virtual int authenticated() const = 0; - virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) = 0; + virtual void authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) = 0; /* template method */ virtual int module_direction() = 0; virtual void addHeader(HttpReply * rep, int accel); @@ -78,7 +78,7 @@ virtual void user (AuthUser *aUser) {_auth_user=aUser;} - static auth_acl_t tryToAuthenticateAndSetAuthUser(AuthUserRequest **, http_hdr_type, HttpRequest *, ConnStateData::Pointer, IPAddress &); + static auth_acl_t tryToAuthenticateAndSetAuthUser(AuthUserRequest **, http_hdr_type, HttpRequest *, ConnStateData *, IPAddress &); static void addReplyAuthHeader(HttpReply * rep, AuthUserRequest * auth_user_request, HttpRequest * request, int accelerated, int internal); AuthUserRequest(); @@ -105,7 +105,7 @@ private: - static auth_acl_t authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData::Pointer conn, IPAddress &src_addr); + static auth_acl_t authenticate(AuthUserRequest ** auth_user_request, http_hdr_type headertype, HttpRequest * request, ConnStateData * conn, IPAddress &src_addr); /* return a message on the 407 error pages */ char *message; Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.139.4.7 retrieving revision 1.139.4.8 diff -u -r1.139.4.7 -r1.139.4.8 --- squid3/src/client_side.cc 29 Dec 2007 15:24:39 -0000 1.139.4.7 +++ squid3/src/client_side.cc 21 Jan 2008 21:24:37 -0000 1.139.4.8 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.139.4.7 2007/12/29 15:24:39 chtsanti Exp $ + * $Id: client_side.cc,v 1.139.4.8 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -122,15 +122,11 @@ /* other */ static IOCB clientWriteComplete; static IOCB clientWriteBodyComplete; -static IOCB clientReadRequest; -static bool clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read); -static void clientAfterReadingRequests(int fd, ConnStateData::Pointer &conn, int do_next_read); -static PF connStateClosed; -static PF requestTimeout; +static bool clientParseRequest(ConnStateData * conn, bool &do_next_read); static PF clientLifetimeTimeout; -static ClientSocketContext *parseHttpRequestAbort(ConnStateData::Pointer & conn, +static ClientSocketContext *parseHttpRequestAbort(ConnStateData * conn, const char *uri); -static ClientSocketContext *parseHttpRequest(ConnStateData::Pointer &, HttpParser *, method_t *, HttpVersion *); +static ClientSocketContext *parseHttpRequest(ConnStateData *, HttpParser *, method_t *, HttpVersion *); #if USE_IDENT static IDCB clientIdentDone; #endif @@ -148,18 +144,16 @@ static bool clientPingHasFinished(ping_data const *aPing); static void clientPrepareLogWithRequestDetails(HttpRequest *, AccessLogEntry *); #ifndef PURIFY -static int connIsUsable(ConnStateData::Pointer conn); +static int connIsUsable(ConnStateData * conn); #endif static int responseFinishedOrFailed(HttpReply * rep, StoreIOBuffer const &receivedData); -static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer & conn); +static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData * conn); static void clientUpdateSocketStats(log_type logType, size_t size); char *skipLeadingSpace(char *aString); -static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno); -static int connFinishedWithConn(ConnStateData::Pointer& conn, int size); static void connNoteUseOfBuffer(ConnStateData* conn, size_t byteCount); -static int connKeepReadingIncompleteRequest(ConnStateData::Pointer & conn); -static void connCancelIncompleteRequests(ConnStateData::Pointer & conn); +static int connKeepReadingIncompleteRequest(ConnStateData * conn); +static void connCancelIncompleteRequests(ConnStateData * conn); static ConnStateData *connStateCreate(const IPAddress &peer, const IPAddress &me, int fd, http_port_list *port); @@ -202,19 +196,18 @@ makeSpaceAvailable(); - // TODO: make clientReadRequest member of ClientSocketContext which is already an AsyncJob - // child class and use asyncCall here. - AsyncCall::Pointer call = commCbCall(11, 5, "clientReadRequest", - CommIoCbPtrFun(clientReadRequest, this)); + typedef CommCbMemFunT Dialer; + AsyncCall::Pointer call = asyncCall(33, 5, "ConnStateData::clientReadRequest", + Dialer(this, &ConnStateData::clientReadRequest)); comm_read(fd, in.addressToReadInto(), getAvailableBufferLength(), call); } void -ClientSocketContext::removeFromConnectionList(ConnStateData::Pointer conn) +ClientSocketContext::removeFromConnectionList(ConnStateData * conn) { ClientSocketContext::Pointer *tempContextPointer; - assert(conn != NULL); + assert(conn != NULL && cbdataReferenceValid(conn)); assert(conn->getCurrentContext() != NULL); /* Unlink us from the connection request list */ tempContextPointer = & conn->currentobject; @@ -591,19 +584,17 @@ } /* This is a handler normally called by comm_close() */ -static void -connStateClosed(int fd, void *data) +void ConnStateData::connStateClosed(const CommCloseCbParams &io) { - ConnStateData *connState = (ConnStateData *)data; - assert (fd == connState->fd); - connState->close(); + assert (fd == io.fd); + close(); } void ConnStateData::close() { debugs(33, 3, "ConnStateData::close: FD " << fd); - openReference = NULL; + deleteThis("ConnStateData::close"); fd = -1; flags.readMoreRequests = false; clientdbEstablished(peer, -1); /* decrement */ @@ -619,7 +610,7 @@ bool ConnStateData::isOpen() const { - return openReference != NULL; + return cbdataReferenceValid(this); } ConnStateData::~ConnStateData() @@ -710,9 +701,9 @@ #ifndef PURIFY int -connIsUsable(ConnStateData::Pointer conn) +connIsUsable(ConnStateData * conn) { - if (conn == NULL || conn->fd == -1) + if (conn == NULL || !cbdataReferenceValid(conn) || conn->fd == -1) return 0; return 1; @@ -1312,14 +1303,17 @@ /* * Set the timeout BEFORE calling clientReadRequest(). */ - commSetTimeout(fd, Config.Timeout.persistent_request, - requestTimeout, this); + typedef CommCbMemFunT TimeoutDialer; + AsyncCall::Pointer timeoutCall = asyncCall(33, 5, "ConnStateData::requestTimeout", + TimeoutDialer(this, &ConnStateData::requestTimeout)); + commSetTimeout(fd, Config.Timeout.persistent_request, timeoutCall); + readSomeData(); /* Please don't do anything with the FD past here! */ } void -ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer & conn) +ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData * conn) { debugs(33, 2, "ClientSocketContextPushDeferredIfNeeded: FD " << conn->fd << " Sending next"); @@ -1342,7 +1336,7 @@ void ClientSocketContext::keepaliveNextRequest() { - ConnStateData::Pointer conn = http->getConn(); + ConnStateData * conn = http->getConn(); bool do_next_read = false; debugs(33, 3, "ClientSocketContext::keepaliveNextRequest: FD " << conn->fd); @@ -1571,7 +1565,7 @@ debugs(33, 5, HERE << "initiateClose: closing for " << reason); if (http != NULL) { - ConnStateData::Pointer conn = http->getConn(); + ConnStateData * conn = http->getConn(); if (conn != NULL) { if (const int64_t expecting = conn->bodySizeLeft()) { @@ -1654,7 +1648,7 @@ extern "C" CSD clientReplyDetach; static ClientSocketContext * -parseHttpRequestAbort(ConnStateData::Pointer & conn, const char *uri) +parseHttpRequestAbort(ConnStateData * conn, const char *uri) { ClientHttpRequest *http; ClientSocketContext *context; @@ -1723,7 +1717,7 @@ } static void -prepareAcceleratedURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, char *url, const char *req_hdr) +prepareAcceleratedURL(ConnStateData * conn, ClientHttpRequest *http, char *url, const char *req_hdr) { int vhost = conn->port->vhost; int vport = conn->port->vport; @@ -1797,7 +1791,7 @@ } static void -prepareTransparentURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, char *url, const char *req_hdr) +prepareTransparentURL(ConnStateData * conn, ClientHttpRequest *http, char *url, const char *req_hdr) { char *host; char ntoabuf[MAX_IPSTRLEN]; @@ -1838,7 +1832,7 @@ * Sets result->flags.parsed_ok to 1 if we have a good request. */ static ClientSocketContext * -parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * method_p, HttpVersion *http_ver) +parseHttpRequest(ConnStateData * conn, HttpParser *hp, method_t * method_p, HttpVersion *http_ver) { char *url = NULL; char *req_hdr = NULL; @@ -2035,19 +2029,19 @@ } int -connReadWasError(ConnStateData::Pointer & conn, comm_err_t flag, int size, int xerrno) +ConnStateData::connReadWasError(comm_err_t flag, int size, int xerrno) { if (flag != COMM_OK) { - debugs(33, 2, "connReadWasError: FD " << conn->fd << ": got flag " << flag); + debugs(33, 2, "connReadWasError: FD " << fd << ": got flag " << flag); return 1; } if (size < 0) { if (!ignoreErrno(xerrno)) { - debugs(33, 2, "connReadWasError: FD " << conn->fd << ": " << xstrerr(xerrno)); + debugs(33, 2, "connReadWasError: FD " << fd << ": " << xstrerr(xerrno)); return 1; - } else if (conn->in.notYetUsed == 0) { - debugs(33, 2, "connReadWasError: FD " << conn->fd << ": no data to process (" << xstrerr(xerrno) << ")"); + } else if (in.notYetUsed == 0) { + debugs(33, 2, "connReadWasError: FD " << fd << ": no data to process (" << xstrerr(xerrno) << ")"); } } @@ -2055,16 +2049,16 @@ } int -connFinishedWithConn(ConnStateData::Pointer & conn, int size) +ConnStateData::connFinishedWithConn(int size) { if (size == 0) { - if (conn->getConcurrentRequestCount() == 0 && conn->in.notYetUsed == 0) { + if (getConcurrentRequestCount() == 0 && in.notYetUsed == 0) { /* no current or pending requests */ - debugs(33, 4, "connFinishedWithConn: FD " << conn->fd << " closed"); + debugs(33, 4, "connFinishedWithConn: FD " << fd << " closed"); return 1; } else if (!Config.onoff.half_closed_clients) { /* admin doesn't want to support half-closed client sockets */ - debugs(33, 3, "connFinishedWithConn: FD " << conn->fd << " aborted (half_closed_clients disabled)"); + debugs(33, 3, "connFinishedWithConn: FD " << fd << " aborted (half_closed_clients disabled)"); return 1; } } @@ -2089,13 +2083,13 @@ } int -connKeepReadingIncompleteRequest(ConnStateData::Pointer & conn) +connKeepReadingIncompleteRequest(ConnStateData * conn) { return conn->in.notYetUsed >= Config.maxRequestHeaderSize ? 0 : 1; } void -connCancelIncompleteRequests(ConnStateData::Pointer & conn) +connCancelIncompleteRequests(ConnStateData * conn) { ClientSocketContext *context = parseHttpRequestAbort(conn, "error:request-too-large"); clientStreamNode *node = context->getClientReplyContext(); @@ -2111,17 +2105,17 @@ context->pullData(); } -static void -clientMaybeReadData(ConnStateData::Pointer &conn, int do_next_read) +void +ConnStateData::clientMaybeReadData(int do_next_read) { if (do_next_read) { - conn->flags.readMoreRequests = true; - conn->readSomeData(); + flags.readMoreRequests = true; + readSomeData(); } } -static void -clientAfterReadingRequests(int fd, ConnStateData::Pointer &conn, int do_next_read) +void +ConnStateData::clientAfterReadingRequests(int do_next_read) { /* * If (1) we are reading a message body, (2) and the connection @@ -2130,7 +2124,7 @@ */ if (fd_table[fd].flags.socket_eof) { - if ((int64_t)conn->in.notYetUsed < conn->bodySizeLeft()) { + if ((int64_t)in.notYetUsed < bodySizeLeft()) { /* Partial request received. Abort client connection! */ debugs(33, 3, "clientAfterReadingRequests: FD " << fd << " aborted, partial request"); comm_close(fd); @@ -2138,11 +2132,11 @@ } } - clientMaybeReadData (conn, do_next_read); + clientMaybeReadData (do_next_read); } static void -clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketContext *context, method_t method, HttpVersion http_ver) +clientProcessRequest(ConnStateData * conn, HttpParser *hp, ClientSocketContext *context, method_t method, HttpVersion http_ver) { ClientHttpRequest *http = context->http; HttpRequest *request = NULL; @@ -2262,7 +2256,7 @@ request->body_pipe = conn->expectRequestBody(request->content_length); // consume header early so that body pipe gets just the body - connNoteUseOfBuffer(conn.getRaw(), http->req_sz); + connNoteUseOfBuffer(conn, http->req_sz); notedUseOfBuffer = true; conn->handleRequestBodyData(); @@ -2294,7 +2288,7 @@ finish: if (!notedUseOfBuffer) - connNoteUseOfBuffer(conn.getRaw(), http->req_sz); + connNoteUseOfBuffer(conn, http->req_sz); /* * DPW 2007-05-18 @@ -2312,7 +2306,7 @@ } static void -connStripBufferWhitespace (ConnStateData::Pointer &conn) +connStripBufferWhitespace (ConnStateData * conn) { while (conn->in.notYetUsed > 0 && xisspace(conn->in.buf[0])) { xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.notYetUsed - 1); @@ -2321,7 +2315,7 @@ } static int -connOkToAddRequest(ConnStateData::Pointer &conn) +connOkToAddRequest(ConnStateData * conn) { int result = conn->getConcurrentRequestCount() < (Config.onoff.pipeline_prefetch ? 2 : 1); @@ -2360,7 +2354,7 @@ * scheduled. */ static bool -clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read) +clientParseRequest(ConnStateData * conn, bool &do_next_read) { method_t method; ClientSocketContext *context; @@ -2437,20 +2431,18 @@ return parsed_req; } -static void -clientReadRequest(int fd, char *buf, size_t size, comm_err_t flag, int xerrno, - void *data) +void +ConnStateData::clientReadRequest(const CommIoCbParams &io) { - debugs(33,5,HERE << "clientReadRequest FD " << fd << " size " << size); - ConnStateData::Pointer conn ((ConnStateData *)data); - conn->reading(false); + debugs(33,5,HERE << "clientReadRequest FD " << io.fd << " size " << io.size); + reading(false); bool do_next_read = 1; /* the default _is_ to read data! - adrian */ - assert (fd == conn->fd); + assert (io.fd == fd); /* Bail out quickly on COMM_ERR_CLOSING - close handlers will tidy up */ - if (flag == COMM_ERR_CLOSING) { + if (io.flag == COMM_ERR_CLOSING) { debugs(33,5, HERE << " FD " << fd << " closing Bailout."); return; } @@ -2462,25 +2454,25 @@ * whole, not individual read() calls. Plus, it breaks our * lame half-close detection */ - if (connReadWasError(conn, flag, size, xerrno)) { + if (connReadWasError(io.flag, io.size, io.xerrno)) { comm_close(fd); return; } - if (flag == COMM_OK) { - if (size > 0) { - kb_incr(&statCounter.client_http.kbytes_in, size); + if (io.flag == COMM_OK) { + if (io.size > 0) { + kb_incr(&statCounter.client_http.kbytes_in, io.size); - conn->handleReadData(buf, size); + handleReadData(io.buf, io.size); /* The above may close the connection under our feets */ - if (!conn->isOpen()) + if (!isOpen()) return; - } else if (size == 0) { + } else if (io.size == 0) { debugs(33, 5, "clientReadRequest: FD " << fd << " closed?"); - if (connFinishedWithConn(conn, size)) { + if (connFinishedWithConn(io.size)) { comm_close(fd); return; } @@ -2503,11 +2495,11 @@ } /* Process next request */ - if (conn->getConcurrentRequestCount() == 0) - fd_note(conn->fd, "Reading next request"); + if (getConcurrentRequestCount() == 0) + fd_note(fd, "Reading next request"); - if (! clientParseRequest(conn, do_next_read)) { - if (!conn->isOpen()) + if (! clientParseRequest(this, do_next_read)) { + if (!isOpen()) return; /* * If the client here is half closed and we failed @@ -2516,17 +2508,17 @@ * succeeds _if_ the buffer is empty which it won't * be if we have an incomplete request. */ - if (conn->getConcurrentRequestCount() == 0 && commIsHalfClosed(fd)) { + if (getConcurrentRequestCount() == 0 && commIsHalfClosed(fd)) { debugs(33, 5, "clientReadRequest: FD " << fd << ": half-closed connection, no completed request parsed, connection closing."); comm_close(fd); return; } } - if (!conn->isOpen()) + if (!isOpen()) return; - clientAfterReadingRequests(fd, conn, do_next_read); + clientAfterReadingRequests(do_next_read); } // called when new request data has been read from the socket @@ -2592,26 +2584,25 @@ } /* general lifetime handler for HTTP requests */ -static void -requestTimeout(int fd, void *data) +void +ConnStateData::requestTimeout(const CommTimeoutCbParams &io) { #if THIS_CONFUSES_PERSISTENT_CONNECTION_AWARE_BROWSERS_AND_USERS - ConnStateData *conn = data; - debugs(33, 3, "requestTimeout: FD " << fd << ": lifetime is expired."); + debugs(33, 3, "requestTimeout: FD " << io.fd << ": lifetime is expired."); - if (COMMIO_FD_WRITECB(fd)->active) { + if (COMMIO_FD_WRITECB(io.fd)->active) { /* FIXME: If this code is reinstated, check the conn counters, * not the fd table state */ /* * Some data has been sent to the client, just close the FD */ - comm_close(fd); - } else if (conn->nrequests) { + comm_close(io.fd); + } else if (nrequests) { /* * assume its a persistent connection; just close it */ - comm_close(fd); + comm_close(io.fd); } else { /* * Generate an error @@ -2619,18 +2610,18 @@ ClientHttpRequest **H; clientStreamNode *node; ClientHttpRequest *http = - parseHttpRequestAbort(conn, "error:Connection%20lifetime%20expired"); + parseHttpRequestAbort(this, "error:Connection%20lifetime%20expired"); node = http->client_stream.tail->prev->data; clientReplyContext *repContext = dynamic_cast(node->data.getRaw()); assert (repContext); repContext->setReplyToError(ERR_LIFETIME_EXP, - HTTP_REQUEST_TIMEOUT, METHOD_NONE, "N/A", &conn->peer.sin_addr, + HTTP_REQUEST_TIMEOUT, METHOD_NONE, "N/A", &peer.sin_addr, NULL, NULL, NULL); /* No requests can be outstanded */ - assert(conn->chr == NULL); + assert(chr == NULL); /* add to the client request queue */ - for (H = &conn->chr; *H; H = &(*H)->next) + for (H = &chr; *H; H = &(*H)->next) ; *H = http; @@ -2641,12 +2632,15 @@ /* * if we don't close() here, we still need a timeout handler! */ - commSetTimeout(fd, 30, requestTimeout, conn); + typedef CommCbMemFunT TimeoutDialer; + AsyncCall::Pointer timeoutCall = asyncCall(33, 5, "ConnStateData::requestTimeout", + TimeoutDialer(this,&ConnStateData::requestTimeout)); + commSetTimeout(io.fd, 30, timeoutCall); /* * Aha, but we don't want a read handler! */ - commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0); + commSetSelect(io.fd, COMM_SELECT_READ, NULL, NULL, 0); } #else @@ -2658,13 +2652,15 @@ * the open has already been completed on another * connection) */ - debugs(33, 3, "requestTimeout: FD " << fd << ": lifetime is expired."); + debugs(33, 3, "requestTimeout: FD " << io.fd << ": lifetime is expired."); - comm_close(fd); + comm_close(io.fd); #endif } + + static void clientLifetimeTimeout(int fd, void *data) { @@ -2763,13 +2759,20 @@ debugs(33, 4, "httpAccept: FD " << newfd << ": accepted"); fd_note(newfd, "client http connect"); - connState = connStateCreate(details->peer, details->me, newfd, s); - comm_add_close_handler(newfd, connStateClosed, connState); + connState = connStateCreate(&details->peer, &details->me, newfd, s); + + typedef CommCbMemFunT Dialer; + AsyncCall::Pointer call = asyncCall(33, 5, "ConnStateData::connStateClosed", + Dialer(connState, &ConnStateData::connStateClosed)); + comm_add_close_handler(newfd, call); if (Config.onoff.log_fqdn) fqdncache_gethostbyaddr(details->peer, FQDN_LOOKUP_IF_MISS); - commSetTimeout(newfd, Config.Timeout.request, requestTimeout, connState); + typedef CommCbMemFunT TimeoutDialer; + AsyncCall::Pointer timeoutCall = asyncCall(33, 5, "ConnStateData::requestTimeout", + TimeoutDialer(connState,&ConnStateData::requestTimeout)); + commSetTimeout(newfd, Config.Timeout.read, timeoutCall); #if USE_IDENT @@ -2957,13 +2960,20 @@ debugs(33, 5, "httpsAccept: FD " << newfd << " accepted, starting SSL negotiation."); fd_note(newfd, "client https connect"); - connState = connStateCreate(details->peer, details->me, newfd, (http_port_list *)s); - comm_add_close_handler(newfd, connStateClosed, connState); + connState = connStateCreate(&details->peer, &details->me, newfd, (http_port_list *)s); + + typedef CommCbMemFunT Dialer; + AsyncCall::Pointer call = asyncCall(33, 5, "ConnStateData::connStateClosed", + Dialer(connState, &ConnStateData::connStateClosed)); + comm_add_close_handler(newfd, call); if (Config.onoff.log_fqdn) fqdncache_gethostbyaddr(details->peer, FQDN_LOOKUP_IF_MISS); - commSetTimeout(newfd, Config.Timeout.request, requestTimeout, connState); + typedef CommCbMemFunT TimeoutDialer; + AsyncCall::Pointer timeoutCall = asyncCall(33, 5, "ConnStateData::requestTimeout", + TimeoutDialer(connState,&ConnStateData::requestTimeout)); + commSetTimeout(newfd, Config.Timeout.request, timeoutCall); #if USE_IDENT @@ -3166,8 +3176,8 @@ clientAclChecklistCreate(const acl_access * acl, ClientHttpRequest * http) { ACLChecklist *ch; - ConnStateData::Pointer conn = http->getConn(); - ch = aclChecklistCreate(acl, http->request, conn.getRaw() != NULL ? conn->rfc931 : dash_str); + ConnStateData * conn = http->getConn(); + ch = aclChecklistCreate(acl, http->request, cbdataReferenceValid(conn) && conn != NULL ? conn->rfc931 : dash_str); /* * hack for ident ACL. It needs to get full addresses, and a place to store @@ -3181,7 +3191,7 @@ * the server end. */ - if (conn.getRaw() != NULL) + if (conn != NULL) ch->conn(conn); /* unreferenced in acl.cc */ return ch; @@ -3191,7 +3201,6 @@ ConnStateData::ConnStateData() :AsyncJob("ConnStateData"), transparent_ (false), reading_ (false), closing_ (false) { - openReference = this; } bool Index: squid3/src/client_side.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.h,v retrieving revision 1.22.4.5 retrieving revision 1.22.4.6 diff -u -r1.22.4.5 -r1.22.4.6 --- squid3/src/client_side.h 29 Dec 2007 15:24:40 -0000 1.22.4.5 +++ squid3/src/client_side.h 21 Jan 2008 21:24:37 -0000 1.22.4.6 @@ -1,5 +1,5 @@ /* - * $Id: client_side.h,v 1.22.4.5 2007/12/29 15:24:40 chtsanti Exp $ + * $Id: client_side.h,v 1.22.4.6 2008/01/21 21:24:37 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,6 +38,7 @@ #include "BodyPipe.h" #include "RefCount.h" #include "ICAP/AsyncJob.h" +#include "CommCalls.h" class ConnStateData; @@ -110,7 +111,7 @@ clientStreamNode * getTail() const; clientStreamNode * getClientReplyContext() const; void connIsFinished(); - void removeFromConnectionList(RefCount conn); + void removeFromConnectionList(ConnStateData * conn); void deferRecipientForLater(clientStreamNode * node, HttpReply * rep, StoreIOBuffer receivedData); bool multipartRangeRequest() const; void registerWithConn(); @@ -127,11 +128,10 @@ }; /* A connection to a socket */ -class ConnStateData : public BodyProducer, public RefCountable +class ConnStateData : public BodyProducer/*, public RefCountable*/ { public: - typedef RefCount Pointer; ConnStateData(); ~ConnStateData(); @@ -209,15 +209,24 @@ void handleReadData(char *buf, size_t size); void handleRequestBodyData(); +//CommCalls related methods + void clientReadRequest(const CommIoCbParams &io); + void connStateClosed(const CommCloseCbParams &io); + void requestTimeout(const CommTimeoutCbParams ¶ms); //AsyncJob virtual classes virtual bool doneAll() const { return BodyProducer::doneAll() && false;} private: + int connReadWasError(comm_err_t flag, int size, int xerrno); + int connFinishedWithConn(int size); + void clientMaybeReadData(int do_next_read); + void clientAfterReadingRequests(int do_next_read); +private: CBDATA_CLASS2(ConnStateData); bool transparent_; bool reading_; bool closing_; - Pointer openReference; + BodyPipe::Pointer bodyPipe; // set when we are reading request body }; Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.112.4.1 retrieving revision 1.112.4.2 diff -u -r1.112.4.1 -r1.112.4.2 --- squid3/src/client_side_reply.cc 29 Dec 2007 15:24:40 -0000 1.112.4.1 +++ squid3/src/client_side_reply.cc 21 Jan 2008 21:24:37 -0000 1.112.4.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.112.4.1 2007/12/29 15:24:40 chtsanti Exp $ + * $Id: client_side_reply.cc,v 1.112.4.2 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1894,7 +1894,7 @@ StoreEntry *entry = http->storeEntry(); - ConnStateData::Pointer conn = http->getConn(); + ConnStateData * conn = http->getConn(); int fd = conn != NULL ? conn->fd : -1; Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.79.4.7 retrieving revision 1.79.4.8 diff -u -r1.79.4.7 -r1.79.4.8 --- squid3/src/client_side_request.cc 29 Dec 2007 15:24:40 -0000 1.79.4.7 +++ squid3/src/client_side_request.cc 21 Jan 2008 21:24:37 -0000 1.79.4.8 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.79.4.7 2007/12/29 15:24:40 chtsanti Exp $ + * $Id: client_side_request.cc,v 1.79.4.8 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -142,7 +142,7 @@ cbdataFree(t); } -ClientHttpRequest::ClientHttpRequest(ConnStateData::Pointer aConn) : +ClientHttpRequest::ClientHttpRequest(ConnStateData * aConn) : #if ICAP_CLIENT AsyncJob("ClientHttpRequest"), #endif @@ -1244,7 +1244,7 @@ // true cause of the error at this point, so I did not pass it. IPAddress noAddr; noAddr.SetNoAddr(); - ConnStateData::Pointer c = getConn(); + ConnStateData * c = getConn(); repContext->setReplyToError(ERR_ICAP_FAILURE, HTTP_INTERNAL_SERVER_ERROR, request->method, NULL, (c != NULL ? c->peer : noAddr), request, NULL, Index: squid3/src/client_side_request.cci =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cci,v retrieving revision 1.4 retrieving revision 1.4.32.1 diff -u -r1.4 -r1.4.32.1 --- squid3/src/client_side_request.cci 12 May 2006 13:49:56 -0000 1.4 +++ squid3/src/client_side_request.cci 21 Jan 2008 21:24:37 -0000 1.4.32.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cci,v 1.4 2006/05/12 13:49:56 squidadm Exp $ + * $Id: client_side_request.cci,v 1.4.32.1 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins @@ -49,23 +49,33 @@ return NULL; } -ConnStateData::Pointer +ConnStateData * ClientHttpRequest::getConn() { + if(!cbdataReferenceValid(conn_)) + return NULL; + return conn_; } -ConnStateData::Pointer const +ConnStateData * const ClientHttpRequest::getConn() const { + if(!cbdataReferenceValid(conn_)) + return NULL; + return conn_; } void -ClientHttpRequest::setConn(ConnStateData::Pointer aConn) +ClientHttpRequest::setConn(ConnStateData * aConn) { assert (conn_ == NULL || aConn == NULL); - conn_ = aConn; + + if(conn_) + cbdataReferenceDone(conn_); + + conn_ = cbdataReference(aConn); } StoreEntry * Index: squid3/src/client_side_request.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.h,v retrieving revision 1.30.4.6 retrieving revision 1.30.4.7 diff -u -r1.30.4.6 -r1.30.4.7 --- squid3/src/client_side_request.h 16 Dec 2007 10:42:32 -0000 1.30.4.6 +++ squid3/src/client_side_request.h 21 Jan 2008 21:24:37 -0000 1.30.4.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.h,v 1.30.4.6 2007/12/16 10:42:32 chtsanti Exp $ + * $Id: client_side_request.h,v 1.30.4.7 2008/01/21 21:24:37 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -72,7 +72,7 @@ #if ICAP_CLIENT void *toCbdata() { return this; } #endif - ClientHttpRequest(ConnStateData::Pointer); + ClientHttpRequest(ConnStateData *); ~ClientHttpRequest(); /* Not implemented - present to prevent synthetic operations */ ClientHttpRequest(ClientHttpRequest const &); @@ -93,9 +93,9 @@ _SQUID_INLINE_ StoreEntry *loggingEntry() const; void loggingEntry(StoreEntry *); - _SQUID_INLINE_ ConnStateData::Pointer getConn(); - _SQUID_INLINE_ ConnStateData::Pointer const getConn() const; - _SQUID_INLINE_ void setConn(ConnStateData::Pointer); + _SQUID_INLINE_ ConnStateData * getConn(); + _SQUID_INLINE_ ConnStateData * const getConn() const; + _SQUID_INLINE_ void setConn(ConnStateData *); HttpRequest *request; /* Parsed URL ... */ char *uri; char *log_uri; @@ -165,7 +165,7 @@ int64_t maxReplyBodySize_; StoreEntry *entry_; StoreEntry *loggingEntry_; - ConnStateData::Pointer conn_; + ConnStateData * conn_; #if ICAP_CLIENT Index: squid3/src/auth/basic/auth_basic.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/basic/auth_basic.cc,v retrieving revision 1.28 retrieving revision 1.28.4.1 diff -u -r1.28 -r1.28.4.1 --- squid3/src/auth/basic/auth_basic.cc 3 Aug 2007 02:51:05 -0000 1.28 +++ squid3/src/auth/basic/auth_basic.cc 21 Jan 2008 21:24:37 -0000 1.28.4.1 @@ -1,5 +1,5 @@ /* - * $Id: auth_basic.cc,v 1.28 2007/08/03 02:51:05 squidadm Exp $ + * $Id: auth_basic.cc,v 1.28.4.1 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -154,7 +154,7 @@ /* log a basic user in */ void -AuthBasicUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) +AuthBasicUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) { assert(user() != NULL); Index: squid3/src/auth/basic/auth_basic.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/basic/auth_basic.h,v retrieving revision 1.13 retrieving revision 1.13.4.1 diff -u -r1.13 -r1.13.4.1 --- squid3/src/auth/basic/auth_basic.h 1 Aug 2007 23:50:53 -0000 1.13 +++ squid3/src/auth/basic/auth_basic.h 21 Jan 2008 21:24:37 -0000 1.13.4.1 @@ -95,7 +95,7 @@ virtual ~AuthBasicUserRequest(); virtual int authenticated() const; - virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type); + virtual void authenticate(HttpRequest * request, ConnStateData *conn, http_hdr_type type); virtual int module_direction(); virtual void module_start(RH *, void *); virtual AuthUser *user() {return _theUser;} Index: squid3/src/auth/digest/auth_digest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/digest/auth_digest.cc,v retrieving revision 1.38.4.1 retrieving revision 1.38.4.2 diff -u -r1.38.4.1 -r1.38.4.2 --- squid3/src/auth/digest/auth_digest.cc 29 Dec 2007 15:25:58 -0000 1.38.4.1 +++ squid3/src/auth/digest/auth_digest.cc 21 Jan 2008 21:24:37 -0000 1.38.4.2 @@ -1,5 +1,5 @@ /* - * $Id: auth_digest.cc,v 1.38.4.1 2007/12/29 15:25:58 chtsanti Exp $ + * $Id: auth_digest.cc,v 1.38.4.2 2008/01/21 21:24:37 chtsanti Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -573,7 +573,7 @@ /* log a digest user in */ void -AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) +AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) { auth_user_t *auth_user; AuthDigestUserRequest *digest_request; Index: squid3/src/auth/digest/auth_digest.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/digest/auth_digest.h,v retrieving revision 1.14 retrieving revision 1.14.20.1 diff -u -r1.14 -r1.14.20.1 --- squid3/src/auth/digest/auth_digest.h 9 May 2007 07:50:41 -0000 1.14 +++ squid3/src/auth/digest/auth_digest.h 21 Jan 2008 21:24:38 -0000 1.14.20.1 @@ -61,7 +61,7 @@ virtual ~AuthDigestUserRequest(); virtual int authenticated() const; - virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type); + virtual void authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type); virtual int module_direction(); virtual void addHeader(HttpReply * rep, int accel); #if WAITING_FOR_TE Index: squid3/src/auth/negotiate/auth_negotiate.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/negotiate/auth_negotiate.cc,v retrieving revision 1.25.4.1 retrieving revision 1.25.4.2 diff -u -r1.25.4.1 -r1.25.4.2 --- squid3/src/auth/negotiate/auth_negotiate.cc 29 Dec 2007 15:25:58 -0000 1.25.4.1 +++ squid3/src/auth/negotiate/auth_negotiate.cc 21 Jan 2008 21:24:38 -0000 1.25.4.2 @@ -1,5 +1,5 @@ /* - * $Id: auth_negotiate.cc,v 1.25.4.1 2007/12/29 15:25:58 chtsanti Exp $ + * $Id: auth_negotiate.cc,v 1.25.4.2 2008/01/21 21:24:38 chtsanti Exp $ * * DEBUG: section 29 Negotiate Authenticator * AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli @@ -660,7 +660,7 @@ } void -AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) +AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) { const char *proxy_auth, *blob; @@ -677,7 +677,7 @@ /* Check that we are in the client side, where we can generate * auth challenges */ - if (conn.getRaw() == NULL) { + if (conn == NULL) { auth_state = AUTHENTICATE_STATE_FAILED; debugs(29, 1, "AuthNegotiateUserRequest::authenticate: attempt to perform authentication without a connection!"); return; @@ -769,7 +769,7 @@ } AuthNegotiateUserRequest::AuthNegotiateUserRequest() : - conn(NULL), auth_state(AUTHENTICATE_STATE_NONE), + /*conn(NULL),*/ auth_state(AUTHENTICATE_STATE_NONE), _theUser(NULL) { waiting=0; Index: squid3/src/auth/negotiate/auth_negotiate.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/negotiate/auth_negotiate.h,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -u -r1.9 -r1.9.4.1 --- squid3/src/auth/negotiate/auth_negotiate.h 28 Aug 2007 22:51:33 -0000 1.9 +++ squid3/src/auth/negotiate/auth_negotiate.h 21 Jan 2008 21:24:38 -0000 1.9.4.1 @@ -59,7 +59,7 @@ AuthNegotiateUserRequest(); virtual ~AuthNegotiateUserRequest(); virtual int authenticated() const; - virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type); + virtual void authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type); virtual int module_direction(); virtual void onConnectionClose(ConnStateData *); virtual void module_start(RH *, void *); @@ -76,7 +76,7 @@ /*we need to store the helper server between requests */ helper_stateful_server *authserver; /* what connection is this associated with */ - ConnStateData::Pointer conn; + /* ConnStateData * conn;*/ /* how far through the authentication process are we? */ auth_state_t auth_state; Index: squid3/src/auth/ntlm/auth_ntlm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/ntlm/auth_ntlm.cc,v retrieving revision 1.47.4.1 retrieving revision 1.47.4.2 diff -u -r1.47.4.1 -r1.47.4.2 --- squid3/src/auth/ntlm/auth_ntlm.cc 29 Dec 2007 15:25:59 -0000 1.47.4.1 +++ squid3/src/auth/ntlm/auth_ntlm.cc 21 Jan 2008 21:24:38 -0000 1.47.4.2 @@ -1,5 +1,5 @@ /* - * $Id: auth_ntlm.cc,v 1.47.4.1 2007/12/29 15:25:59 chtsanti Exp $ + * $Id: auth_ntlm.cc,v 1.47.4.2 2008/01/21 21:24:38 chtsanti Exp $ * * DEBUG: section 29 NTLM Authenticator * AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli @@ -596,7 +596,7 @@ } void -AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type) +AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) { const char *proxy_auth, *blob; @@ -613,7 +613,7 @@ /* Check that we are in the client side, where we can generate * auth challenges */ - if (conn.getRaw() == NULL) { + if (conn == NULL || !cbdataReferenceValid(conn)) { auth_state = AUTHENTICATE_STATE_FAILED; debugs(29, 1, "AuthNTLMUserRequest::authenticate: attempt to perform authentication without a connection!"); return; @@ -706,7 +706,7 @@ } AuthNTLMUserRequest::AuthNTLMUserRequest() : - conn(NULL), auth_state(AUTHENTICATE_STATE_NONE), + /*conn(NULL),*/ auth_state(AUTHENTICATE_STATE_NONE), _theUser(NULL) { waiting=0; Index: squid3/src/auth/ntlm/auth_ntlm.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/ntlm/auth_ntlm.h,v retrieving revision 1.16 retrieving revision 1.16.4.1 diff -u -r1.16 -r1.16.4.1 --- squid3/src/auth/ntlm/auth_ntlm.h 28 Aug 2007 22:51:33 -0000 1.16 +++ squid3/src/auth/ntlm/auth_ntlm.h 21 Jan 2008 21:24:38 -0000 1.16.4.1 @@ -59,7 +59,7 @@ AuthNTLMUserRequest(); virtual ~AuthNTLMUserRequest(); virtual int authenticated() const; - virtual void authenticate(HttpRequest * request, ConnStateData::Pointer conn, http_hdr_type type); + virtual void authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type); virtual int module_direction(); virtual void onConnectionClose(ConnStateData *); virtual void module_start(RH *, void *); @@ -74,7 +74,7 @@ /*we need to store the helper server between requests */ helper_stateful_server *authserver; /* what connection is this associated with */ - ConnStateData::Pointer conn; +// ConnStateData * conn; /* how far through the authentication process are we? */ auth_state_t auth_state;