proxygen
ConnectionFilterTest Class Reference
Inheritance diagram for ConnectionFilterTest:
ScopedServerTest testing::Test

Protected Member Functions

HTTPServerOptions createDefaultOpts () override
 
- Protected Member Functions inherited from ScopedServerTest
std::unique_ptr< ScopedHTTPServercreateScopedServer ()
 
std::unique_ptr< CurlClientconnectSSL (const std::string &caFile="", const std::string &certFile="", const std::string &keyFile="")
 
std::unique_ptr< CurlClientconnectPlainText ()
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Public Member Functions inherited from ScopedServerTest
void SetUp () override
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
- Protected Attributes inherited from ScopedServerTest
folly::EventBase evb_
 
folly::SocketAddress address_
 
HHWheelTimer::UniquePtr timer_
 
HTTPServer::IPConfig cfg_
 

Detailed Description

Definition at line 710 of file HTTPServerTest.cpp.

Member Function Documentation

HTTPServerOptions ConnectionFilterTest::createDefaultOpts ( )
inlineoverrideprotectedvirtual

Reimplemented from ScopedServerTest.

Definition at line 712 of file HTTPServerTest.cpp.

References proxygen::RequestHandlerChain::addThen(), folly::ssl::OpenSSLCertUtils::getCommonName(), folly::AsyncTransport::getPeerCert(), proxygen::HTTPServerOptions::handlerFactories, proxygen::HTTPServerOptions::newConnectionFilter, string, proxygen::HTTPServerOptions::threads, and folly::Optional< Value >::value_or().

712  {
713  HTTPServerOptions options;
714  options.threads = 4;
715  options.handlerFactories =
719  .addThen<TestHandlerFactory>()
720  .build();
721  options.newConnectionFilter =
722  [](const folly::AsyncTransportWrapper* sock,
723  const folly::SocketAddress* /* address */,
724  const std::string& /* nextProtocolName */,
725  wangle::SecureTransportType /* secureTransportType */,
726  const wangle::TransportInfo& /* tinfo */) {
727  auto cert = sock->getPeerCert();
728  if (!cert || OpenSSLCertUtils::getCommonName(*cert).value_or("") !=
729  "testuser1") {
730  throw std::runtime_error("Client cert is missing or invalid.");
731  }
732  };
733  return options;
734  }
RequestHandlerChain & addThen(Args &&...args)
NewConnectionFilter newConnectionFilter
std::vector< std::unique_ptr< RequestHandlerFactory > > handlerFactories
const char * string
Definition: Conv.cpp:212
virtual ssl::X509UniquePtr getPeerCert() const

The documentation for this class was generated from the following file: