proxygen
|
#include <HTTPDirectResponseHandler.h>
Public Member Functions | |
HTTPDirectResponseHandler (unsigned statusCode, const std::string &statusMsg, const HTTPErrorPage *errorPage=nullptr) | |
void | forceConnectionClose (bool close) |
void | setTransaction (HTTPTransaction *txn) noexceptoverride |
void | detachTransaction () noexceptoverride |
void | onHeadersComplete (std::unique_ptr< HTTPMessage > msg) noexceptoverride |
void | onBody (std::unique_ptr< folly::IOBuf > chain) noexceptoverride |
void | onTrailers (std::unique_ptr< HTTPHeaders > trailers) noexceptoverride |
void | onEOM () noexceptoverride |
void | onUpgrade (UpgradeProtocol protocol) noexceptoverride |
void | onError (const HTTPException &error) noexceptoverride |
void | onEgressPaused () noexceptoverride |
void | onEgressResumed () noexceptoverride |
Public Member Functions inherited from proxygen::HTTPTransactionHandler | |
virtual void | onChunkHeader (size_t) noexcept |
virtual void | onChunkComplete () noexcept |
virtual void | onPushedTransaction (HTTPTransaction *) noexcept |
virtual void | onExTransaction (HTTPTransaction *) noexcept |
virtual void | onGoaway (ErrorCode) noexcept |
virtual | ~HTTPTransactionHandler () |
Private Member Functions | |
~HTTPDirectResponseHandler () override | |
Private Attributes | |
HTTPTransaction * | txn_ |
const HTTPErrorPage * | errorPage_ |
std::string | statusMessage_ |
unsigned | statusCode_ |
bool | headersSent_:1 |
bool | eomSent_:1 |
bool | forceConnectionClose_:1 |
Definition at line 18 of file HTTPDirectResponseHandler.h.
proxygen::HTTPDirectResponseHandler::HTTPDirectResponseHandler | ( | unsigned | statusCode, |
const std::string & | statusMsg, | ||
const HTTPErrorPage * | errorPage = nullptr |
||
) |
Definition at line 21 of file HTTPDirectResponseHandler.cpp.
|
overrideprivate |
Definition at line 33 of file HTTPDirectResponseHandler.cpp.
Referenced by onEgressResumed().
|
overridevirtualnoexcept |
Called once after a transaction successfully completes. It will be called even if a read or write error happened earlier. This is a terminal callback, which means that the HTTPTransaction object that gives this call will be invalid after this function completes.
Implements proxygen::HTTPTransactionHandler.
Definition at line 42 of file HTTPDirectResponseHandler.cpp.
Referenced by forceConnectionClose().
|
inline |
Definition at line 24 of file HTTPDirectResponseHandler.h.
References folly::netops::close(), detachTransaction(), folly::pushmi::operators::error(), forceConnectionClose_, folly::pushmi::__adl::noexcept(), onBody(), onEOM(), onError(), onHeadersComplete(), onTrailers(), onUpgrade(), and setTransaction().
|
overridevirtualnoexcept |
Can be called multiple times per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress().
Implements proxygen::HTTPTransactionHandler.
Definition at line 77 of file HTTPDirectResponseHandler.cpp.
Referenced by forceConnectionClose().
|
inlineoverridevirtualnoexcept |
If the remote side's receive buffer fills up, this callback will be invoked so you can attempt to stop sending to the remote side.
Implements proxygen::HTTPTransactionHandler.
Definition at line 37 of file HTTPDirectResponseHandler.h.
|
inlineoverridevirtualnoexcept |
This callback lets you know that the remote side has resumed reading and you can now continue to send data.
Implements proxygen::HTTPTransactionHandler.
Definition at line 38 of file HTTPDirectResponseHandler.h.
References ~HTTPDirectResponseHandler().
|
overridevirtualnoexcept |
Can be called once per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress(). After this callback is received, there will be no more normal ingress callbacks received (onEgress*() and onError() may still be invoked). The Handler should consider ingress complete after receiving this message. This Transaction is still valid, and work may still occur on it until detachTransaction is called.
Implements proxygen::HTTPTransactionHandler.
Definition at line 87 of file HTTPDirectResponseHandler.cpp.
References eomSent_, proxygen::HTTPTransaction::sendEOM(), and txn_.
Referenced by forceConnectionClose(), and onError().
|
overridevirtualnoexcept |
Can be called at any time before detachTransaction(). This callback implies that an error has occurred. To determine if ingress or egress is affected, check the direciont on the HTTPException. If the direction is INGRESS, it MAY still be possible to send egress.
Implements proxygen::HTTPTransactionHandler.
Definition at line 95 of file HTTPDirectResponseHandler.cpp.
References eomSent_, folly::pushmi::operators::error(), headersSent_, proxygen::HTTPException::INGRESS, proxygen::kErrorTimeout, onEOM(), and onHeadersComplete().
Referenced by forceConnectionClose().
|
overridevirtualnoexcept |
Called at most once per transaction. This is usually the first ingress callback. It is possible to get a read error before this however. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress().
Implements proxygen::HTTPTransactionHandler.
Definition at line 46 of file HTTPDirectResponseHandler.cpp.
References proxygen::HTTPHeaders::add(), folly::IOBuf::computeChainDataLength(), proxygen::HTTPErrorPage::Page::content, proxygen::HTTPErrorPage::Page::contentType, proxygen::empty_string, errorPage_, forceConnectionClose_, proxygen::HTTPErrorPage::generate(), proxygen::HTTPMessage::getDefaultReason(), proxygen::HTTPMessage::getHeaders(), headersSent_, proxygen::HTTP_HEADER_CONNECTION, proxygen::HTTP_HEADER_CONTENT_LENGTH, proxygen::HTTP_HEADER_CONTENT_TYPE, folly::gen::move, proxygen::HTTPTransaction::sendBody(), proxygen::HTTPTransaction::sendHeaders(), proxygen::HTTPMessage::setHTTPVersion(), proxygen::HTTPMessage::setStatusCode(), proxygen::HTTPMessage::setStatusMessage(), statusCode_, statusMessage_, and txn_.
Referenced by forceConnectionClose(), and onError().
|
overridevirtualnoexcept |
Can be called any number of times per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress(). Trailers can be received once right before the EOM of a chunked HTTP/1.1 reponse or multiple times per transaction from SPDY and HTTP/2.0 HEADERS frames.
Implements proxygen::HTTPTransactionHandler.
Definition at line 81 of file HTTPDirectResponseHandler.cpp.
Referenced by forceConnectionClose().
|
overridevirtualnoexcept |
Can be called once per transaction. If you had previously called pauseIngress(), this callback will be delayed until you call resumeIngress(). After this callback is invoked, further data will be forwarded using the onBody() callback. Once the data transfer is completed (EOF recevied in case of CONNECT), onEOM() callback will be invoked.
Implements proxygen::HTTPTransactionHandler.
Definition at line 92 of file HTTPDirectResponseHandler.cpp.
Referenced by forceConnectionClose().
|
overridevirtualnoexcept |
Called once per transaction. This notifies the handler of which transaction it should talk to and will receive callbacks from.
Implements proxygen::HTTPTransactionHandler.
Definition at line 37 of file HTTPDirectResponseHandler.cpp.
References txn_.
Referenced by forceConnectionClose().
|
private |
Definition at line 48 of file HTTPDirectResponseHandler.h.
|
private |
Definition at line 44 of file HTTPDirectResponseHandler.h.
Referenced by onHeadersComplete().
|
private |
Definition at line 49 of file HTTPDirectResponseHandler.h.
Referenced by forceConnectionClose(), and onHeadersComplete().
|
private |
Definition at line 47 of file HTTPDirectResponseHandler.h.
Referenced by onError(), and onHeadersComplete().
|
private |
Definition at line 46 of file HTTPDirectResponseHandler.h.
Referenced by onHeadersComplete().
|
private |
Definition at line 45 of file HTTPDirectResponseHandler.h.
Referenced by onHeadersComplete().
|
private |
Definition at line 43 of file HTTPDirectResponseHandler.h.
Referenced by onEOM(), onHeadersComplete(), and setTransaction().