proxygen
|
#include <HTTPSessionAcceptor.h>
Public Member Functions | |
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 () |
virtual HTTPTransaction::Handler * | newHandler (HTTPTransaction &txn, HTTPMessage *msg) noexcept=0 |
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 |
Protected Attributes | |
HTTPSessionStats * | downstreamSessionStats_ {nullptr} |
Protected Attributes inherited from proxygen::HTTPAcceptor | |
AcceptorConfiguration | accConfig_ |
Protected Attributes inherited from wangle::Acceptor | |
folly::EventBase * | base_ {nullptr} |
const ServerSocketConfig | accConfig_ |
folly::AsyncSocket::OptionMap | socketOptions_ |
std::unique_ptr< SSLContextManager > | sslCtxManager_ |
SecurityProtocolContextManager | securityProtocolCtxManager_ |
TLSPlaintextPeekingCallback | tlsPlaintextPeekingCallback_ |
DefaultToSSLPeekingCallback | defaultPeekingCallback_ |
DefaultToFizzPeekingCallback | defaultFizzPeeker_ |
wangle::ConnectionManager::UniquePtr | downstreamConnectionManager_ |
std::shared_ptr< SSLCacheProvider > | cacheProvider_ |
wangle::TLSTicketKeySeeds | currentSecrets_ |
Private Attributes | |
std::unique_ptr< HTTPErrorPage > | defaultErrorPage_ |
std::unique_ptr< HTTPErrorPage > | diagnosticErrorPage_ |
std::shared_ptr< HTTPCodecFactory > | codecFactory_ {} |
SimpleController | simpleController_ |
HTTPSession::InfoCallback * | sessionInfoCb_ {nullptr} |
Static Private Attributes | |
static const folly::SocketAddress | unknownSocketAddress_ |
Additional Inherited Members | |
Public Types inherited from wangle::Acceptor | |
enum | State : uint32_t { State::kInit, State::kRunning, State::kDraining, State::kDone } |
Static Public Member Functions inherited from wangle::Acceptor | |
static uint64_t | getTotalNumPendingSSLConns () |
Specialization of Acceptor that serves as an abstract base for acceptors that support HTTP and related protocols.
Definition at line 28 of file HTTPSessionAcceptor.h.
|
explicit |
Definition at line 26 of file HTTPSessionAcceptor.cpp.
Referenced by onSessionCreationError().
|
explicit |
Definition at line 29 of file HTTPSessionAcceptor.cpp.
References proxygen::HTTPAcceptor::accConfig_, and codecFactory_.
|
override |
Definition at line 41 of file HTTPSessionAcceptor.cpp.
|
privatedelete |
|
protectedvirtual |
Definition at line 127 of file HTTPSessionAcceptor.cpp.
References wangle::Acceptor::downstreamConnectionManager_.
Referenced by makeNewAsyncSocket().
|
inline |
return the codec factory for this session
Definition at line 86 of file HTTPSessionAcceptor.h.
References codecFactory_, newHandler(), and folly::pushmi::__adl::noexcept().
|
inlineprotectedvirtual |
This function is invoked when a new session is created to get the controller to associate with the new session. Child classes may override this function to provide their own more sophisticated controller here.
Definition at line 119 of file HTTPSessionAcceptor.h.
References simpleController_.
Referenced by onNewConnection().
|
inline |
Access the default error page generator.
Definition at line 47 of file HTTPSessionAcceptor.h.
References defaultErrorPage_.
|
inline |
Access the diagnostic error page generator.
Definition at line 61 of file HTTPSessionAcceptor.h.
References addr, diagnosticErrorPage_, and getErrorPage().
|
virtual |
Access the right error page generator for a connection.
localAddr | Address of the local end of the connection. |
Definition at line 44 of file HTTPSessionAcceptor.cpp.
References defaultErrorPage_, diagnosticErrorPage_, proxygen::HTTPAcceptor::isInternal(), and folly::SocketAddress::isPrivateAddress().
Referenced by getDiagnosticErrorPage(), proxygen::SimpleController::getParseErrorHandler(), and proxygen::SimpleController::getTransactionTimeoutHandler().
|
inlinevirtual |
Definition at line 108 of file HTTPSessionAcceptor.h.
References proxygen::HTTPAcceptor::accConfig_, and proxygen::AcceptorConfiguration::HTTP2PrioritiesEnabled.
Referenced by onNewConnection().
|
inlineprotected |
Definition at line 125 of file HTTPSessionAcceptor.h.
References onNewConnection(), sessionInfoCb_, and string.
|
inlineoverrideprotectedvirtual |
Reimplemented from wangle::Acceptor.
Definition at line 137 of file HTTPSessionAcceptor.h.
References dropIdleConnections().
|
pure virtualnoexcept |
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.
Implemented in proxygen::HTTPServerAcceptor, and HTTPTargetSessionAcceptor.
Referenced by getCodecFactory(), and proxygen::SimpleController::getRequestHandler().
|
overrideprotectedvirtual |
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 58 of file HTTPSessionAcceptor.cpp.
References proxygen::HTTPAcceptor::accConfig_, wangle::ServerSocketConfig::bindAddress, codec, codecFactory_, folly::SocketAddress::describe(), proxygen::DOWNSTREAM, downstreamSessionStats_, proxygen::AcceptorConfiguration::egressSettings, getController(), getHttp2PrioritiesEnabled(), proxygen::HTTPAcceptor::getTransactionTimeoutSet(), proxygen::AcceptorConfiguration::initialReceiveWindow, folly::SocketAddress::isFamilyInet(), proxygen::kErrorUnsupportedScheme, proxygen::AcceptorConfiguration::maxConcurrentIncomingStreams, folly::gen::move, onSessionCreationError(), proxygen::AcceptorConfiguration::receiveSessionWindowSize, proxygen::AcceptorConfiguration::receiveStreamWindowSize, sessionInfoCb_, proxygen::HTTPSession::setEgressSettings(), proxygen::HTTPSession::setFlowControl(), proxygen::HTTPSession::setHTTP2PrioritiesEnabled(), proxygen::HTTPSession::setMaxConcurrentIncomingStreams(), proxygen::HTTPSession::setSessionStats(), proxygen::HTTPSessionBase::setWriteBufferLimit(), proxygen::HTTPDownstreamSession::startNow(), unknownSocketAddress_, and proxygen::AcceptorConfiguration::writeBufferLimit.
Referenced by getSessionInfoCallback(), and proxygen::HTTPServerAcceptor::onNewConnection().
|
inlineprotectedvirtual |
Reimplemented in HTTPTargetSessionAcceptor.
Definition at line 145 of file HTTPSessionAcceptor.h.
References HTTPSessionAcceptor(), and operator=().
Referenced by onNewConnection().
|
privatedelete |
Referenced by onSessionCreationError().
|
inline |
Set the codec factory for this session
Definition at line 79 of file HTTPSessionAcceptor.h.
References codecFactory_.
|
inline |
Set the default error page generator.
Definition at line 40 of file HTTPSessionAcceptor.h.
References defaultErrorPage_, and folly::gen::move.
|
inline |
Set an alternate error page generator to use for internal clients.
Definition at line 54 of file HTTPSessionAcceptor.h.
References diagnosticErrorPage_, and folly::gen::move.
|
inline |
Set an HTTPSession::InfoCallback to use for each session instead of the acceptor object.
Definition at line 104 of file HTTPSessionAcceptor.h.
References sessionInfoCb_.
|
private |
Definition at line 157 of file HTTPSessionAcceptor.h.
Referenced by getCodecFactory(), HTTPSessionAcceptor(), onNewConnection(), and setCodecFactory().
|
private |
General-case error page generator
Definition at line 152 of file HTTPSessionAcceptor.h.
Referenced by getDefaultErrorPage(), getErrorPage(), and setDefaultErrorPage().
|
private |
Generator of more detailed error pages for internal clients
Definition at line 155 of file HTTPSessionAcceptor.h.
Referenced by getDiagnosticErrorPage(), getErrorPage(), and setDiagnosticErrorPage().
|
protected |
Definition at line 123 of file HTTPSessionAcceptor.h.
Referenced by onNewConnection().
|
private |
Definition at line 161 of file HTTPSessionAcceptor.h.
Referenced by getSessionInfoCallback(), onNewConnection(), and setSessionInfoCallback().
|
private |
Definition at line 159 of file HTTPSessionAcceptor.h.
Referenced by getController().
|
staticprivate |
0.0.0.0:0, a valid address to use if getsockname() or getpeername() fails
Definition at line 166 of file HTTPSessionAcceptor.h.
Referenced by onNewConnection().