29 sslContext_ = sock->getSSLContext();
31 if (tokenBindingContext_) {
33 std::make_shared<TokenBindingServerExtension>(tokenBindingContext_);
37 transport_->accept(
this);
42 const std::shared_ptr<FizzServerContext>& fizzContext,
43 const std::shared_ptr<fizz::ServerExtensions>& extensions) {
46 asyncSock->cacheAddresses();
51 void FizzAcceptorHandshakeHelper::fizzHandshakeSuccess(
53 if (loggingCallback_) {
54 loggingCallback_->logFizzHandshakeSuccess(*transport);
57 VLOG(3) <<
"Fizz handshake success";
59 tinfo_.acceptTime = acceptTime_;
61 tinfo_.securityType = transport->getSecurityProtocol();
62 tinfo_.sslSetupTime = std::chrono::duration_cast<std::chrono::milliseconds>(
64 if (extension_ && extension_->getNegotiatedKeyParam().hasValue()) {
65 tinfo_.negotiatedTokenBindingKeyParameters =
66 static_cast<uint8_t>(*extension_->getNegotiatedKeyParam());
69 auto* handshakeLogging = transport->getState().handshakeLogging();
70 if (handshakeLogging && handshakeLogging->clientSni) {
71 tinfo_.sslServerName =
72 std::make_shared<std::string>(*handshakeLogging->clientSni);
75 auto appProto = transport->getApplicationProtocol();
78 SecureTransportType::TLS,
79 SSLErrorEnum::NO_ERROR);
82 void FizzAcceptorHandshakeHelper::fizzHandshakeError(
84 if (loggingCallback_) {
85 loggingCallback_->logFizzHandshakeError(*transport, ex);
88 auto elapsedTime = std::chrono::duration_cast<std::chrono::milliseconds>(
90 VLOG(3) <<
"Fizz handshake error after " << elapsedTime.count() <<
" ms; " 91 << transport->getRawBytesReceived() <<
" bytes received & " 92 << transport->getRawBytesWritten() <<
" bytes sent: " << ex.what();
94 auto handshakeException =
95 folly::make_exception_wrapper<FizzHandshakeException>(
96 sslError_, elapsedTime, transport->getRawBytesReceived());
103 const std::shared_ptr<folly::SSLContext>&
context,
110 void FizzAcceptorHandshakeHelper::fizzHandshakeAttemptFallback(
111 std::unique_ptr<folly::IOBuf> clientHello) {
112 VLOG(3) <<
"Fallback to OpenSSL";
119 sslSocket_ = createSSLSocket(sslContext_, evb, fd);
126 void FizzAcceptorHandshakeHelper::handshakeSuc(
128 auto appProto = sock->getApplicationProtocol();
129 if (!appProto.empty()) {
130 VLOG(3) <<
"Client selected next protocol " << appProto;
132 VLOG(3) <<
"Client did not select a next protocol";
137 tinfo_.acceptTime = acceptTime_;
138 tinfo_.sslSetupTime = std::chrono::duration_cast<std::chrono::milliseconds>(
145 SecureTransportType::TLS,
146 SSLErrorEnum::NO_ERROR);
149 void FizzAcceptorHandshakeHelper::handshakeErr(
152 auto elapsedTime = std::chrono::duration_cast<std::chrono::milliseconds>(
154 VLOG(3) <<
"SSL handshake error after " << elapsedTime.count() <<
" ms; " 155 << sock->getRawBytesReceived() <<
" bytes received & " 156 << sock->getRawBytesWritten() <<
" bytes sent: " << ex.what();
158 auto sslEx = folly::make_exception_wrapper<SSLException>(
159 sslError_, elapsedTime, sock->getRawBytesReceived());
std::chrono::steady_clock::time_point now()
constexpr detail::Map< Move > move
requires E e noexcept(noexcept(s.error(std::move(e))))
std::unique_ptr< AsyncSSLSocket, Destructor > UniquePtr
AsyncSSLSocket::UniquePtr sslSocket_
static void fillSSLTransportInfoFields(folly::AsyncSSLSocket *sock, TransportInfo &tinfo)
std::unique_ptr< AsyncFizzServerT, folly::DelayedDestruction::Destructor > UniquePtr
AsyncFizzClient::UniquePtr transport_
folly::Function< void()> callback_
AsyncFizzServerT< ServerStateMachine > AsyncFizzServer
std::unique_ptr< AsyncSocket, Destructor > UniquePtr