proxygen
proxygen::RejectConnectFilter Class Reference

#include <RejectConnectFilter.h>

Inheritance diagram for proxygen::RejectConnectFilter:
proxygen::Filter proxygen::RequestHandler proxygen::ResponseHandler

Public Member Functions

 RejectConnectFilter (RequestHandler *upstream)
 
void onRequest (std::unique_ptr< HTTPMessage >) noexceptoverride
 
void onBody (std::unique_ptr< folly::IOBuf >) noexceptoverride
 
void onUpgrade (UpgradeProtocol) noexceptoverride
 
void onEOM () noexceptoverride
 
void requestComplete () noexceptoverride
 
void onError (ProxygenError err) noexceptoverride
 
void onEgressPaused () noexceptoverride
 
void onEgressResumed () noexceptoverride
 
void sendHeaders (HTTPMessage &) noexceptoverride
 
void sendChunkHeader (size_t) noexceptoverride
 
void sendBody (std::unique_ptr< folly::IOBuf >) noexceptoverride
 
void sendChunkTerminator () noexceptoverride
 
void sendEOM () noexceptoverride
 
void sendAbort () noexceptoverride
 
void refreshTimeout () noexceptoverride
 
- Public Member Functions inherited from proxygen::Filter
 Filter (RequestHandler *upstream)
 
void setResponseHandler (ResponseHandler *handler) noexceptoverride
 
void onRequest (std::unique_ptr< HTTPMessage > headers) noexceptoverride
 
void onBody (std::unique_ptr< folly::IOBuf > body) noexceptoverride
 
void onUpgrade (UpgradeProtocol protocol) noexceptoverride
 
void onEOM () noexceptoverride
 
void requestComplete () noexceptoverride
 
void onError (ProxygenError err) noexceptoverride
 
void onEgressPaused () noexceptoverride
 
void onEgressResumed () noexceptoverride
 
bool canHandleExpect () noexceptoverride
 
ExMessageHandlergetExHandler () noexceptoverride
 
void sendHeaders (HTTPMessage &msg) noexceptoverride
 
void sendChunkHeader (size_t len) noexceptoverride
 
void sendBody (std::unique_ptr< folly::IOBuf > body) noexceptoverride
 
void sendChunkTerminator () noexceptoverride
 
void sendEOM () noexceptoverride
 
void sendAbort () noexceptoverride
 
void refreshTimeout () noexceptoverride
 
void pauseIngress () noexceptoverride
 
void resumeIngress () noexceptoverride
 
ResponseHandlernewPushedResponse (PushHandler *handler) noexceptoverride
 
const wangle::TransportInfogetSetupTransportInfo () const noexceptoverride
 
void getCurrentTransportInfo (wangle::TransportInfo *tinfo) const override
 
- Public Member Functions inherited from proxygen::RequestHandler
virtual ResponseHandlergetDownstream () noexcept
 
virtual ~RequestHandler ()
 
- Public Member Functions inherited from proxygen::ResponseHandler
 ResponseHandler (RequestHandler *upstream)
 
virtual ~ResponseHandler ()
 
virtual ResponseHandlernewExMessage (ExMessageHandler *, bool=false) noexcept
 
HTTPTransactiongetTransaction () const noexcept
 

Additional Inherited Members

- Protected Attributes inherited from proxygen::RequestHandler
ResponseHandlerdownstream_ {nullptr}
 
- Protected Attributes inherited from proxygen::ResponseHandler
RequestHandlerupstream_ {nullptr}
 
HTTPTransactiontxn_ {nullptr}
 

Detailed Description

A filter that rejects CONNECT/UPGRADE requests.

Definition at line 21 of file RejectConnectFilter.h.

Constructor & Destructor Documentation

proxygen::RejectConnectFilter::RejectConnectFilter ( RequestHandler upstream)
inlineexplicit

Definition at line 23 of file RejectConnectFilter.h.

Referenced by proxygen::RejectConnectFilterFactory::onRequest().

23  : Filter(upstream) {
24  }
Filter(RequestHandler *upstream)
Definition: Filters.h:31

Member Function Documentation

void proxygen::RejectConnectFilter::onBody ( std::unique_ptr< folly::IOBuf body)
inlineoverridevirtualnoexcept

Invoked when we get part of body for the request.

Implements proxygen::RequestHandler.

Definition at line 33 of file RejectConnectFilter.h.

33 {}
void proxygen::RejectConnectFilter::onEgressPaused ( )
inlineoverridevirtualnoexcept

Signals from HTTP layer when client queue is full or empty. If you are sending a streaming response, consider implementing these and acting accordingly. Saves your server from running out of memory.

Reimplemented from proxygen::RequestHandler.

Definition at line 55 of file RejectConnectFilter.h.

55  {
56  }
void proxygen::RejectConnectFilter::onEgressResumed ( )
inlineoverridevirtualnoexcept

Reimplemented from proxygen::RequestHandler.

Definition at line 58 of file RejectConnectFilter.h.

58  {
59  }
void proxygen::RejectConnectFilter::onEOM ( )
inlineoverridevirtualnoexcept

Invoked when we finish receiving the body.

Implements proxygen::RequestHandler.

Definition at line 37 of file RejectConnectFilter.h.

37  {
38  }
void proxygen::RejectConnectFilter::onError ( ProxygenError  err)
inlineoverridevirtualnoexcept

Request failed. Maybe because of read/write error on socket or client not being able to send request in time.

NOTE: Can be invoked at any time (except for before onRequest).

No more callbacks will be invoked after this. You should clean up after yourself.

Implements proxygen::RequestHandler.

Definition at line 45 of file RejectConnectFilter.h.

References proxygen::RequestHandler::onError(), and proxygen::ResponseHandler::upstream_.

45  {
46  // If onError is invoked before we forward the error
47  if (upstream_) {
48  upstream_->onError(err);
49  upstream_ = nullptr;
50  }
51 
52  delete this;
53  }
RequestHandler * upstream_
virtual void onError(ProxygenError err) noexcept=0
void proxygen::RejectConnectFilter::onRequest ( std::unique_ptr< HTTPMessage headers)
inlineoverridevirtualnoexcept

Invoked when we have successfully fetched headers from client. This will always be the first callback invoked on your handler.

Implements proxygen::RequestHandler.

Definition at line 26 of file RejectConnectFilter.h.

References proxygen::RequestHandler::downstream_, proxygen::kErrorMethodNotSupported, proxygen::RequestHandler::onError(), proxygen::ResponseBuilder::rejectUpgradeRequest(), and proxygen::ResponseHandler::upstream_.

26  {
28  upstream_ = nullptr;
29 
30  ResponseBuilder(downstream_).rejectUpgradeRequest();
31  }
RequestHandler * upstream_
virtual void onError(ProxygenError err) noexcept=0
ResponseHandler * downstream_
void proxygen::RejectConnectFilter::onUpgrade ( UpgradeProtocol  prot)
inlineoverridevirtualnoexcept

Invoked when the session has been upgraded to a different protocol

Implements proxygen::RequestHandler.

Definition at line 35 of file RejectConnectFilter.h.

35 {}
void proxygen::RejectConnectFilter::refreshTimeout ( )
inlineoverridevirtualnoexcept

Implements proxygen::ResponseHandler.

Definition at line 77 of file RejectConnectFilter.h.

77  {
78  }
void proxygen::RejectConnectFilter::requestComplete ( )
inlineoverridevirtualnoexcept

Invoked when request processing has been completed and nothing more needs to be done. This may be a good place to log some stats and clean up resources. This is distinct from onEOM() because it is invoked after the response is fully sent. Once this callback has been received, downstream_ should be considered invalid.

Implements proxygen::RequestHandler.

Definition at line 40 of file RejectConnectFilter.h.

References proxygen::ResponseHandler::upstream_.

40  {
41  CHECK(!upstream_);
42  delete this;
43  }
RequestHandler * upstream_
void proxygen::RejectConnectFilter::sendAbort ( )
inlineoverridevirtualnoexcept

Implements proxygen::ResponseHandler.

Definition at line 74 of file RejectConnectFilter.h.

74  {
75  }
void proxygen::RejectConnectFilter::sendBody ( std::unique_ptr< folly::IOBuf )
inlineoverridevirtualnoexcept

Implements proxygen::ResponseHandler.

Definition at line 66 of file RejectConnectFilter.h.

66 {}
void proxygen::RejectConnectFilter::sendChunkHeader ( size_t  )
inlineoverridevirtualnoexcept

Implements proxygen::ResponseHandler.

Definition at line 64 of file RejectConnectFilter.h.

64 {}
void proxygen::RejectConnectFilter::sendChunkTerminator ( )
inlineoverridevirtualnoexcept

Implements proxygen::ResponseHandler.

Definition at line 68 of file RejectConnectFilter.h.

68  {
69  }
void proxygen::RejectConnectFilter::sendEOM ( )
inlineoverridevirtualnoexcept

Implements proxygen::ResponseHandler.

Definition at line 71 of file RejectConnectFilter.h.

71  {
72  }
void proxygen::RejectConnectFilter::sendHeaders ( HTTPMessage msg)
inlineoverridevirtualnoexcept

NOTE: We take response message as non-const reference, to allow filters between your handler and client to be able to modify response if they want to.

eg. a compression filter might want to change the content-encoding

Implements proxygen::ResponseHandler.

Definition at line 62 of file RejectConnectFilter.h.

62 {}

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