proxygen
|
#include <HTTPServerAcceptor.h>
Public Member Functions | |
void | setCompletionCallback (std::function< void()> f) |
~HTTPServerAcceptor () override | |
Public Member Functions inherited from proxygen::HTTPSessionAcceptor | |
HTTPSessionAcceptor (const AcceptorConfiguration &accConfig) | |
HTTPSessionAcceptor (const AcceptorConfiguration &accConfig, std::shared_ptr< HTTPCodecFactory > codecFactory) | |
~HTTPSessionAcceptor () override | |
void | setDefaultErrorPage (std::unique_ptr< HTTPErrorPage > generator) |
const HTTPErrorPage * | getDefaultErrorPage () const |
void | setDiagnosticErrorPage (std::unique_ptr< HTTPErrorPage > generator) |
const HTTPErrorPage * | getDiagnosticErrorPage () const |
virtual const HTTPErrorPage * | getErrorPage (const folly::SocketAddress &addr) const |
void | setCodecFactory (std::shared_ptr< HTTPCodecFactory > codecFactory) |
std::shared_ptr< HTTPCodecFactory > | getCodecFactory () |
void | setSessionInfoCallback (HTTPSession::InfoCallback *cb) |
virtual bool | getHttp2PrioritiesEnabled () |
Public Member Functions inherited from proxygen::HTTPAcceptor | |
HTTPAcceptor (const AcceptorConfiguration &accConfig) | |
bool | isInternal () const |
virtual const WheelTimerInstance & | getTransactionTimeoutSet () |
void | init (folly::AsyncServerSocket *serverSocket, folly::EventBase *eventBase, wangle::SSLStats *=nullptr) override |
const AcceptorConfiguration & | getConfig () const |
Public Member Functions inherited from wangle::Acceptor | |
Acceptor (const ServerSocketConfig &accConfig) | |
~Acceptor () override | |
virtual void | setSSLCacheProvider (const std::shared_ptr< SSLCacheProvider > &cacheProvider) |
virtual void | resetSSLContextConfigs () |
void | addSSLContextConfig (const SSLContextConfig &sslCtxConfig) |
SSLContextManager * | getSSLContextManager () const |
virtual void | setTLSTicketSecrets (const std::vector< std::string > &oldSecrets, const std::vector< std::string > ¤tSecrets, const std::vector< std::string > &newSecrets) |
uint32_t | getNumConnections () const |
virtual folly::EventBase * | getEventBase () const |
virtual wangle::ConnectionManager * | getConnectionManager () |
void | addConnection (wangle::ManagedConnection *connection) |
State | getState () const |
std::chrono::milliseconds | getConnTimeout () const |
const std::string & | getName () const |
std::chrono::milliseconds | getSSLHandshakeTimeout () const |
void | setGracefulShutdownTimeout (std::chrono::milliseconds gracefulShutdown) |
std::chrono::milliseconds | getGracefulShutdownTimeout () const |
virtual void | forceStop () |
bool | isSSL () const |
const ServerSocketConfig & | getConfig () const |
virtual void | onDoneAcceptingConnection (int fd, const folly::SocketAddress &clientAddr, std::chrono::steady_clock::time_point acceptTime) noexcept |
void | processEstablishedConnection (int fd, const folly::SocketAddress &clientAddr, std::chrono::steady_clock::time_point acceptTime, TransportInfo &tinfo) noexcept |
virtual void | startHandshakeManager (folly::AsyncSSLSocket::UniquePtr sslSock, Acceptor *acceptor, const folly::SocketAddress &clientAddr, std::chrono::steady_clock::time_point acceptTime, TransportInfo &tinfo) noexcept |
void | drainAllConnections () |
virtual void | drainConnections (double pctToDrain) |
void | dropAllConnections () |
virtual void | dropConnections (double pctToDrop) |
virtual void | plaintextConnectionReady (folly::AsyncTransportWrapper::UniquePtr sock, const folly::SocketAddress &clientAddr, const std::string &nextProtocolName, SecureTransportType secureTransportType, TransportInfo &tinfo) |
void | connectionReady (folly::AsyncTransportWrapper::UniquePtr sock, const folly::SocketAddress &clientAddr, const std::string &nextProtocolName, SecureTransportType secureTransportType, TransportInfo &tinfo) |
virtual void | sslConnectionReady (folly::AsyncTransportWrapper::UniquePtr sock, const folly::SocketAddress &clientAddr, const std::string &nextProtocol, SecureTransportType secureTransportType, TransportInfo &tinfo) |
virtual void | sslConnectionError (const folly::exception_wrapper &ex) |
virtual void | updateSSLStats (const folly::AsyncTransportWrapper *, std::chrono::milliseconds, SSLErrorEnum) noexcept |
Public Member Functions inherited from folly::AsyncServerSocket::AcceptCallback | |
virtual | ~AcceptCallback ()=default |
virtual void | acceptStarted () noexcept |
Public Member Functions inherited from wangle::ConnectionManager::Callback | |
virtual | ~Callback ()=default |
Public Member Functions inherited from folly::AsyncUDPServerSocket::Callback | |
virtual void | onListenPaused () noexcept |
virtual void | onListenResumed () noexcept |
virtual | ~Callback ()=default |
Static Public Member Functions | |
static AcceptorConfiguration | makeConfig (const HTTPServer::IPConfig &ipConfig, const HTTPServerOptions &opts) |
static std::unique_ptr< HTTPServerAcceptor > | make (const AcceptorConfiguration &conf, const HTTPServerOptions &opts, const std::shared_ptr< HTTPCodecFactory > &codecFactory=nullptr) |
Static Public Member Functions inherited from wangle::Acceptor | |
static uint64_t | getTotalNumPendingSSLConns () |
Private Member Functions | |
HTTPServerAcceptor (const AcceptorConfiguration &conf, const std::shared_ptr< HTTPCodecFactory > &codecFactory, std::vector< RequestHandlerFactory * > handlerFactories, const HTTPServerOptions &options) | |
HTTPTransaction::Handler * | newHandler (HTTPTransaction &txn, HTTPMessage *msg) noexceptoverride |
void | onNewConnection (folly::AsyncTransportWrapper::UniquePtr sock, const folly::SocketAddress *address, const std::string &nextProtocolName, wangle::SecureTransportType secureTransportType, const wangle::TransportInfo &tinfo) override |
void | onConnectionsDrained () override |
Private Attributes | |
const HTTPServerOptions & | serverOptions_ |
std::function< void()> | completionCallback_ |
const std::vector< RequestHandlerFactory * > | handlerFactories_ {nullptr} |
Definition at line 18 of file HTTPServerAcceptor.h.
|
override |
Definition at line 95 of file HTTPServerAcceptor.cpp.
|
private |
Definition at line 81 of file HTTPServerAcceptor.cpp.
Referenced by make().
|
static |
Definition at line 65 of file HTTPServerAcceptor.cpp.
References f, proxygen::HTTPServerOptions::handlerFactories, and HTTPServerAcceptor().
Referenced by proxygen::AcceptorFactory::newAcceptor().
|
static |
Definition at line 23 of file HTTPServerAcceptor.cpp.
References wangle::ServerSocketConfig::acceptBacklog, proxygen::HTTPServer::IPConfig::acceptorSocketOptions, proxygen::HTTPServer::IPConfig::address, proxygen::AcceptorConfiguration::allowedPlaintextUpgradeProtocols, proxygen::HTTPServer::IPConfig::allowInsecureConnectionsOnSecureServer, wangle::ServerSocketConfig::allowInsecureConnectionsOnSecureServer, wangle::ServerSocketConfig::bindAddress, wangle::ServerSocketConfig::connectionIdleTimeout, proxygen::AcceptorConfiguration::egressSettings, proxygen::ENABLE_EX_HEADERS, proxygen::HTTPServerOptions::enableExHeaders, proxygen::HTTPServer::IPConfig::enableTCPFastOpen, wangle::ServerSocketConfig::enableTCPFastOpen, proxygen::HTTPServer::IPConfig::fastOpenQueueSize, wangle::ServerSocketConfig::fastOpenQueueSize, proxygen::HTTPServerOptions::h2cEnabled, folly::Optional< Value >::hasValue(), proxygen::HTTPServer::HTTP2, proxygen::HTTPServerOptions::idleTimeout, proxygen::AcceptorConfiguration::initialReceiveWindow, proxygen::HTTPServerOptions::initialReceiveWindow, wangle::ServerSocketConfig::initialTicketSeeds, proxygen::http2::kProtocolCleartextString, proxygen::HTTPServerOptions::listenBacklog, proxygen::AcceptorConfiguration::maxConcurrentIncomingStreams, proxygen::HTTPServerOptions::maxConcurrentIncomingStreams, proxygen::AcceptorConfiguration::plaintextProtocol, proxygen::HTTPServer::IPConfig::protocol, proxygen::AcceptorConfiguration::receiveSessionWindowSize, proxygen::HTTPServerOptions::receiveSessionWindowSize, proxygen::AcceptorConfiguration::receiveStreamWindowSize, proxygen::HTTPServerOptions::receiveStreamWindowSize, wangle::ServerSocketConfig::setSocketOptions(), proxygen::HTTPServer::SPDY, proxygen::HTTPServer::IPConfig::sslConfigs, wangle::ServerSocketConfig::sslContextConfigs, proxygen::HTTPServer::IPConfig::strictSSL, wangle::ServerSocketConfig::strictSSL, proxygen::HTTPServer::IPConfig::ticketSeeds, proxygen::AcceptorConfiguration::transactionIdleTimeout, and folly::Optional< Value >::value().
Referenced by proxygen::HTTPServer::start().
|
overrideprivatevirtualnoexcept |
Create a Handler for a new transaction. The transaction and HTTP message (request) are passed so the implementation can construct different handlers based on these. The transaction will be explicitly set on the handler later via setTransaction. The request message will be passed in onHeadersComplete.
Implements proxygen::HTTPSessionAcceptor.
Definition at line 98 of file HTTPServerAcceptor.cpp.
References h, handlerFactories_, and proxygen::RequestHandler::onRequest().
|
overrideprivatevirtual |
onConnectionsDrained() will be called once all connections have been drained while the acceptor is stopping.
Subclasses can override this method to perform any subclass-specific cleanup.
Reimplemented from wangle::Acceptor.
Definition at line 137 of file HTTPServerAcceptor.cpp.
References completionCallback_.
|
overrideprivatevirtual |
Invoked when a new connection is created. This is where application starts processing a new downstream connection.
NOTE: Application should add the new connection to downstreamConnectionManager so that it can be garbage collected after certain period of idleness.
sock | the socket connected to the client |
address | the address of the client |
nextProtocolName | the name of the L6 or L7 protocol to be spoken on the connection, if known (e.g., from TLS NPN during secure connection setup), or an empty string if unknown |
secureTransportType | the name of the secure transport type that was requested by the client. |
Reimplemented from wangle::Acceptor.
Definition at line 117 of file HTTPServerAcceptor.cpp.
References folly::exceptionStr(), folly::pushmi::operators::filter, folly::gen::move, proxygen::HTTPServerOptions::newConnectionFilter, proxygen::HTTPSessionAcceptor::onNewConnection(), and serverOptions_.
void proxygen::HTTPServerAcceptor::setCompletionCallback | ( | std::function< void()> | f | ) |
Invokes the given method when all the connections are drained
Definition at line 91 of file HTTPServerAcceptor.cpp.
References completionCallback_, and f.
|
private |
Definition at line 55 of file HTTPServerAcceptor.h.
Referenced by onConnectionsDrained(), and setCompletionCallback().
|
private |
Definition at line 56 of file HTTPServerAcceptor.h.
Referenced by newHandler().
|
private |
Definition at line 54 of file HTTPServerAcceptor.h.
Referenced by onNewConnection().