]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
required fixes to PeerConnector to work with Ssl::ServerBio fixes
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Sat, 19 Mar 2016 19:31:06 +0000 (21:31 +0200)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Sat, 19 Mar 2016 19:31:06 +0000 (21:31 +0200)
src/ssl/PeerConnector.cc

index 695abc8bd83af55f3a4474494bc3496664d1cb8f..740745b3d7d9d7cb6b2454347e61bc9674ed2294 100644 (file)
@@ -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<Ssl::ServerBio *>(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);
 }