Skip to content

Commit

Permalink
Make ssl context manager available in Fizz handshake helpers
Browse files Browse the repository at this point in the history
Summary: Enables Fizz handshake helpers to get access to SSLContextManager to help with ssl context selection when we know SNI upfront.

Reviewed By: mingtaoy

Differential Revision: D46523258

fbshipit-source-id: b89472ad1e51c331be9faa9afeb69c9ed9c16fb4
  • Loading branch information
Abdulbaki Aydin authored and facebook-github-bot committed Jun 20, 2023
1 parent d02762d commit 2a059bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions thrift/lib/cpp2/security/FizzPeeker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ void ThriftFizzAcceptorHandshakeHelper::start(
folly::AsyncSSLSocket::UniquePtr sock,
wangle::AcceptorHandshakeHelper::Callback* callback) noexcept {
callback_ = callback;
sslContext_ = sock->getSSLContext();

if (thriftParametersContext_) {
thriftExtension_ =
Expand Down Expand Up @@ -119,13 +118,14 @@ FizzPeeker::getThriftHelper(
const folly::SocketAddress& clientAddr,
std::chrono::steady_clock::time_point acceptTime,
wangle::TransportInfo& tinfo) {
if (!context_) {
if (!(context_ && sslContextManager_)) {
return nullptr;
}
auto optionsCopy = options_;
return folly::DelayedDestructionUniquePtr<ThriftFizzAcceptorHandshakeHelper>(
new ThriftFizzAcceptorHandshakeHelper(
context_,
sslContextManager_,
clientAddr,
acceptTime,
tinfo,
Expand Down
4 changes: 3 additions & 1 deletion thrift/lib/cpp2/security/FizzPeeker.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ class ThriftFizzAcceptorHandshakeHelper
public:
ThriftFizzAcceptorHandshakeHelper(
std::shared_ptr<const fizz::server::FizzServerContext> context,
std::shared_ptr<const wangle::SSLContextManager> sslContextManager,
const folly::SocketAddress& clientAddr,
std::chrono::steady_clock::time_point acceptTime,
wangle::TransportInfo& tinfo,
wangle::FizzHandshakeOptions&& options,
fizz::AsyncFizzBase::TransportOptions transportOptions)
: wangle::FizzAcceptorHandshakeHelper::FizzAcceptorHandshakeHelper(
context,
std::move(context),
std::move(sslContextManager),
clientAddr,
acceptTime,
tinfo,
Expand Down

0 comments on commit 2a059bd

Please sign in to comment.