From: Alex Rousskov Date: Thu, 1 Dec 2011 20:50:18 +0000 (-0700) Subject: Made ConnStateData::switchToHttps() and friends return void X-Git-Tag: BumpSslServerFirst.take01~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1ce2822dc939e6c2888637e0c045ddbc8ed74392;p=thirdparty%2Fsquid.git Made ConnStateData::switchToHttps() and friends return void in preparation of making this code path asynchronous. No runtime changes expected as their return value was not used anyway. --- diff --git a/src/client_side.cc b/src/client_side.cc index 7e07cdab93..61e844ec43 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3478,7 +3478,7 @@ ConnStateData::sslCrtdHandleReply(const char * reply) getSslContextDone(NULL); } -bool +void ConnStateData::getSslContextStart() { char const * host = sslHostName.termedBuf(); @@ -3490,7 +3490,8 @@ ConnStateData::getSslContextStart() debugs(33, 5, HERE << "SSL certificate for " << host << " have found in cache"); if (Ssl::verifySslCertificateDate(dynCtx)) { debugs(33, 5, HERE << "Cached SSL certificate for " << host << " is valid"); - return getSslContextDone(dynCtx); + getSslContextDone(dynCtx); + return; } else { debugs(33, 5, HERE << "Cached SSL certificate for " << host << " is out of date. Delete this certificate from cache"); ssl_ctx_cache.remove(host); @@ -3509,17 +3510,18 @@ ConnStateData::getSslContextStart() Ssl::writeCertAndPrivateKeyToMemory(port->signingCert, port->signPkey, bufferToWrite); request_message.composeBody(map, bufferToWrite); Ssl::Helper::GetInstance()->sslSubmit(request_message, sslCrtdHandleReplyWrapper, this); - return true; + return; #else debugs(33, 5, HERE << "Generating SSL certificate for " << host); dynCtx = Ssl::generateSslContext(host, port->signingCert, port->signPkey); - return getSslContextDone(dynCtx, true); + getSslContextDone(dynCtx, true); + return; #endif //USE_SSL_CRTD } - return getSslContextDone(NULL); + getSslContextDone(NULL); } -bool +void ConnStateData::getSslContextDone(SSL_CTX * sslContext, bool isNew) { // Try to add generated ssl context to storage. @@ -3543,7 +3545,7 @@ ConnStateData::getSslContextDone(SSL_CTX * sslContext, bool isNew) if (!port->staticSslContext) { debugs(83, 1, "Closing SSL " << clientConnection->remote << " as lacking SSL context"); clientConnection->close(); - return false; + return; } else { debugs(33, 5, HERE << "Using static ssl context."); sslContext = port->staticSslContext.get(); @@ -3552,7 +3554,7 @@ ConnStateData::getSslContextDone(SSL_CTX * sslContext, bool isNew) SSL *ssl = NULL; if (!(ssl = httpsCreate(clientConnection, sslContext))) - return false; + return; // commSetConnTimeout() was called for this request before we switched. @@ -3560,10 +3562,9 @@ ConnStateData::getSslContextDone(SSL_CTX * sslContext, bool isNew) Comm::SetSelect(clientConnection->fd, COMM_SELECT_READ, NULL, NULL, 0); Comm::SetSelect(clientConnection->fd, COMM_SELECT_READ, clientNegotiateSSL, this, 0); switchedToHttps_ = true; - return true; } -bool +void ConnStateData::switchToHttps(const char *host) { assert(!switchedToHttps_); @@ -3579,7 +3580,7 @@ ConnStateData::switchToHttps(const char *host) flags.readMore = true; debugs(33, 5, HERE << "converting " << clientConnection << " to SSL"); - return getSslContextStart(); + getSslContextStart(); } #endif /* USE_SSL */ diff --git a/src/client_side.h b/src/client_side.h index e895024f04..f0960f138d 100644 --- a/src/client_side.h +++ b/src/client_side.h @@ -307,19 +307,19 @@ public: #if USE_SSL /// Start to create dynamic SSL_CTX for host or uses static port SSL context. - bool getSslContextStart(); + void getSslContextStart(); /** * Done create dynamic ssl certificate. * * \param[in] isNew if generated certificate is new, so we need to add this certificate to storage. */ - bool getSslContextDone(SSL_CTX * sslContext, bool isNew = false); + void getSslContextDone(SSL_CTX * sslContext, bool isNew = false); /// Callback function. It is called when squid receive message from ssl_crtd. static void sslCrtdHandleReplyWrapper(void *data, char *reply); /// Proccess response from ssl_crtd. void sslCrtdHandleReply(const char * reply); - bool switchToHttps(const char *host); + void switchToHttps(const char *host); bool switchedToHttps() const { return switchedToHttps_; } #else bool switchedToHttps() const { return false; }