--------------------- PatchSet 7486 Date: 2008/03/20 21:22:45 Author: chtsanti Branch: async-calls Tag: (none) Log: Converting ClientHttpRequest::sslBumpEstablish method to be used by CommCalls Make the ClientHttpRequest an AsyncJob based class when squid is compiled with --enable-ssl Members: src/client_side_request.cc:1.79.4.12->1.79.4.13 src/client_side_request.h:1.30.4.9->1.30.4.10 Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.79.4.12 retrieving revision 1.79.4.13 diff -u -r1.79.4.12 -r1.79.4.13 --- squid3/src/client_side_request.cc 19 Mar 2008 22:01:09 -0000 1.79.4.12 +++ squid3/src/client_side_request.cc 20 Mar 2008 21:22:46 -0000 1.79.4.13 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.79.4.12 2008/03/19 22:01:09 chtsanti Exp $ + * $Id: client_side_request.cc,v 1.79.4.13 2008/03/20 21:22:46 chtsanti Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -144,7 +144,7 @@ } ClientHttpRequest::ClientHttpRequest(ConnStateData * aConn) : -#if ICAP_CLIENT +#if ICAP_CLIENT || USE_SSL AsyncJob("ClientHttpRequest"), #endif loggingEntry_(NULL) @@ -948,6 +948,7 @@ } // called when comm_write has completed +/* static void SslBumpEstablish(int, char *, size_t, comm_err_t errflag, int, void *data) { @@ -957,15 +958,15 @@ assert(r && cbdataReferenceValid(r)); r->sslBumpEstablish(errflag); } - +*/ void -ClientHttpRequest::sslBumpEstablish(comm_err_t errflag) +ClientHttpRequest::sslBumpEstablish(const CommIoCbParams &io) { // Bail out quickly on COMM_ERR_CLOSING - close handlers will tidy up - if (errflag == COMM_ERR_CLOSING) + if (io.flag == COMM_ERR_CLOSING) return; - if (errflag) { + if (io.flag) { getConn()->startClosing("CONNECT response failure in SslBump"); return; } @@ -985,8 +986,11 @@ // TODO: Unify with tunnel.cc and add a Server(?) header static const char *const conn_established = "HTTP/1.0 200 Connection established\r\n\r\n"; - comm_write(fd, conn_established, strlen(conn_established), - &SslBumpEstablish, this, NULL); + + typedef CommCbMemFunT Dialer; + Dialer dialer(this, &ClientHttpRequest::sslBumpEstablish); + AsyncCall::Pointer call = asyncCall(85, 5, "ClientHttpRequest::sslBumpEstablish", dialer); + comm_write(fd, conn_established, strlen(conn_established), call); } #endif Index: squid3/src/client_side_request.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.h,v retrieving revision 1.30.4.9 retrieving revision 1.30.4.10 diff -u -r1.30.4.9 -r1.30.4.10 --- squid3/src/client_side_request.h 12 Feb 2008 19:04:49 -0000 1.30.4.9 +++ squid3/src/client_side_request.h 20 Mar 2008 21:22:45 -0000 1.30.4.10 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.h,v 1.30.4.9 2008/02/12 19:04:49 rousskov Exp $ + * $Id: client_side_request.h,v 1.30.4.10 2008/03/20 21:22:45 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -63,13 +63,15 @@ #if ICAP_CLIENT : public ICAPInitiator, // to start ICAP transactions public BodyConsumer // to receive reply bodies in request satisf. mode +#elif USE_SSL + : virtual public AsyncJob #endif { public: void *operator new (size_t); void operator delete (void *); -#if ICAP_CLIENT +#if ICAP_CLIENT || USE_SSL void *toCbdata() { return this; } #endif ClientHttpRequest(ConnStateData *); @@ -167,7 +169,7 @@ public: bool sslBumpNeeded() const; void sslBumpStart(); - void sslBumpEstablish(comm_err_t errflag); + void sslBumpEstablish(const CommIoCbParams &io); #endif #if ICAP_CLIENT