From: Christos Tsantilas Date: Sat, 19 Mar 2016 19:31:06 +0000 (+0200) Subject: required fixes to PeerConnector to work with Ssl::ServerBio fixes X-Git-Tag: SQUID_4_0_11~29^2~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc7d2971d7b5f0741157d2d23b73ffeb86766df2;p=thirdparty%2Fsquid.git required fixes to PeerConnector to work with Ssl::ServerBio fixes --- diff --git a/src/ssl/PeerConnector.cc b/src/ssl/PeerConnector.cc index 695abc8bd8..740745b3d7 100644 --- a/src/ssl/PeerConnector.cc +++ b/src/ssl/PeerConnector.cc @@ -15,6 +15,7 @@ #include "fde.h" #include "HttpRequest.h" #include "SquidConfig.h" +#include "ssl/bio.h" #include "ssl/cert_validate_message.h" #include "ssl/Config.h" #include "ssl/helper.h" @@ -338,8 +339,25 @@ Ssl::PeerConnector::handleNegotiateError(const int ret) void Ssl::PeerConnector::noteWantRead() { - setReadTimeout(); const int fd = serverConnection()->fd; + Security::SessionPtr ssl = fd_table[fd].ssl.get(); + BIO *b = SSL_get_rbio(ssl); + Ssl::ServerBio *srvBio = static_cast(b->ptr); + if (srvBio->holdRead()) { + if (srvBio->gotHello()) { + srvBio->holdRead(false); + // Schedule a negotiateSSl to allow openSSL parse received data + Ssl::PeerConnector::NegotiateSsl(fd, this); + return; + } else if (srvBio->gotHelloFailed()) { + srvBio->holdRead(false); + debugs(83, DBG_IMPORTANT, "Error parsing SSL Server Hello Message on FD " << fd); + // Schedule a negotiateSSl to allow openSSL parse received data + Ssl::PeerConnector::NegotiateSsl(fd, this); + return; + } + } + setReadTimeout(); Comm::SetSelect(fd, COMM_SELECT_READ, &NegotiateSsl, this, 0); }