return;
}
+ if (answer.tunneled) {
+ // TODO: When ConnStateData establishes tunnels, its state changes
+ // [in ways that may affect logging?]. Consider informing
+ // ConnStateData about our tunnel or otherwise unifying tunnel
+ // establishment [side effects].
+ unregister(serverConn); // async call owns it now
+ complete(); // destroys us
+ return;
+ }
+
// should reach ConnStateData before the dispatched Client job starts
CallJobHere1(17, 4, request->clientConnectionManager, ConnStateData,
ConnStateData::notePeerConnection, serverConnection());
class EncryptorAnswer
{
public:
+ EncryptorAnswer(): tunneled(false) {}
~EncryptorAnswer(); ///< deletes error if it is still set
Comm::ConnectionPointer conn; ///< peer connection (secured on success)
/// answer recepients must clear the error member in order to keep its info
/// XXX: We should refcount ErrorState instead of cbdata-protecting it.
CbcPointer<ErrorState> error; ///< problem details (nil on success)
+
+ /// whether we spliced the connections instead of negotiating encryption
+ bool tunneled;
};
std::ostream &operator <<(std::ostream &, const Security::EncryptorAnswer &);
// and if done, switch to tunnel mode
if (sslFinalized()) {
debugs(83,5, "Abort NegotiateSSL on FD " << serverConn->fd << " and splice the connection");
+ callBack();
}
}
}
auto clientSsl = fd_table[clientConn->fd].ssl.get();
clientConn->tlsNegotiations()->fillWith(clientSsl);
switchToTunnel(request.getRaw(), clientConn, serverConn);
+ tunnelInsteadOfNegotiating();
}
}
}
}
}
+void
+Ssl::PeekingPeerConnector::tunnelInsteadOfNegotiating()
+{
+ Must(callback != NULL);
+ CbDialer *dialer = dynamic_cast<CbDialer*>(callback->getDialer());
+ Must(dialer);
+ dialer->answer().tunneled = true;
+ debugs(83, 5, "The SSL negotiation with server aborted");
+}
+
+
static void cbCheckForPeekAndSpliceDone(allow_t answer, void *data);
private:
+
+ /// Inform caller class that the SSL negotiation aborted
+ void tunnelInsteadOfNegotiating();
+
Comm::ConnectionPointer clientConn; ///< TCP connection to the client
AsyncCall::Pointer callback; ///< we call this with the results
AsyncCall::Pointer closeHandler; ///< we call this when the connection closed
void bail(ErrorState *error); ///< Return an error to the PeerConnector caller
+ /// Callback the caller class, and pass the ready to communicate secure
+ /// connection or an error if PeerConnector failed.
+ void callBack();
+
/// If called the certificates validator will not used
void bypassCertValidator() {useCertValidator_ = false;}
PeerConnector(const PeerConnector &); // not implemented
PeerConnector &operator =(const PeerConnector &); // not implemented
- /// Callback the caller class, and pass the ready to communicate secure
- /// connection or an error if PeerConnector failed.
- void callBack();
-
/// Process response from cert validator helper
void sslCrtvdHandleReply(Ssl::CertValidationResponsePointer);