proxygen
proxygen::HTTPEvent Class Reference

#include <HTTPEvent.h>

Public Types

enum  Type : uint8_t {
  Type::MESSAGE_BEGIN, Type::HEADERS_COMPLETE, Type::BODY, Type::CHUNK_HEADER,
  Type::CHUNK_COMPLETE, Type::TRAILERS_COMPLETE, Type::MESSAGE_COMPLETE, Type::UPGRADE
}
 

Public Member Functions

 HTTPEvent (HTTPCodec::StreamID streamID, Type event, bool upgrade=false)
 
 HTTPEvent (HTTPCodec::StreamID streamID, Type event, size_t length)
 
 HTTPEvent (HTTPCodec::StreamID streamID, Type event, std::unique_ptr< HTTPMessage > headers)
 
 HTTPEvent (HTTPCodec::StreamID streamID, Type event, std::unique_ptr< folly::IOBuf > body)
 
 HTTPEvent (HTTPCodec::StreamID streamID, Type event, std::unique_ptr< HTTPHeaders > trailers)
 
 HTTPEvent (HTTPCodec::StreamID streamID, Type event, std::unique_ptr< HTTPException > error)
 
 HTTPEvent (HTTPCodec::StreamID streamID, Type event, UpgradeProtocol protocol)
 
Type getEvent () const
 
HTTPCodec::StreamID getStreamID () const
 
std::unique_ptr< HTTPMessagegetHeaders ()
 
std::unique_ptr< folly::IOBufgetBody ()
 
std::unique_ptr< HTTPExceptiongetError ()
 
bool isUpgrade () const
 
size_t getChunkLength () const
 
std::unique_ptr< HTTPHeadersgetTrailers ()
 
UpgradeProtocol getUpgradeProtocol ()
 

Private Attributes

std::unique_ptr< HTTPMessageheaders_
 
std::unique_ptr< folly::IOBufbody_
 
std::unique_ptr< HTTPHeaderstrailers_
 
std::unique_ptr< HTTPExceptionerror_
 
HTTPCodec::StreamID streamID_
 
size_t length_
 
Type event_
 
bool upgrade_
 
UpgradeProtocol protocol_
 

Detailed Description

Helper class that holds some event in the lifecycle of an HTTP request or response.

The main use for this class is to queue up events in situations where the code handling events isn't able to process them and the thing generating events isn't able to stop.

Definition at line 27 of file HTTPEvent.h.

Member Enumeration Documentation

Enumerator
MESSAGE_BEGIN 
HEADERS_COMPLETE 
BODY 
CHUNK_HEADER 
CHUNK_COMPLETE 
TRAILERS_COMPLETE 
MESSAGE_COMPLETE 
UPGRADE 

Definition at line 29 of file HTTPEvent.h.

29  : uint8_t {
30  // Ingress events
31  MESSAGE_BEGIN,
32  HEADERS_COMPLETE,
33  BODY,
34  CHUNK_HEADER,
35  CHUNK_COMPLETE,
36  TRAILERS_COMPLETE,
37  MESSAGE_COMPLETE,
38  UPGRADE
39  };
#define UPGRADE
Definition: http_parser.c:144

Constructor & Destructor Documentation

proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
bool  upgrade = false 
)
inline

Definition at line 41 of file HTTPEvent.h.

42  :
43  streamID_(streamID), length_(0), event_(event),
44  upgrade_(upgrade) {}
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131
proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
size_t  length 
)
inline

Definition at line 46 of file HTTPEvent.h.

References CHUNK_HEADER.

47  :
48  streamID_(streamID), length_(length), event_(event),
49  upgrade_(false) {
50  // This constructor should only be used for CHUNK_HEADER.
51  // (Ideally we would take the event type as a template parameter
52  // so we could enforce this check at compile time. Unfortunately,
53  // that would prevent us from using this constructor with
54  // deferredCallbacks_.emplace().)
55  CHECK(event == Type::CHUNK_HEADER);
56  }
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131
proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
std::unique_ptr< HTTPMessage headers 
)
inline

Definition at line 58 of file HTTPEvent.h.

59  :
61  event_(event), upgrade_(false) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< HTTPMessage > headers_
Definition: HTTPEvent.h:112
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131
proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
std::unique_ptr< folly::IOBuf body 
)
inline

Definition at line 63 of file HTTPEvent.h.

64  :
66  event_(event), upgrade_(false) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< folly::IOBuf > body_
Definition: HTTPEvent.h:113
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131
proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
std::unique_ptr< HTTPHeaders trailers 
)
inline

Definition at line 68 of file HTTPEvent.h.

69  :
70  trailers_(std::move(trailers)), streamID_(streamID), length_(0),
71  event_(event), upgrade_(false) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPEvent.h:114
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131
proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
std::unique_ptr< HTTPException error 
)
inline

Definition at line 73 of file HTTPEvent.h.

74  :
76  event_(event), upgrade_(false) {}
std::unique_ptr< HTTPException > error_
Definition: HTTPEvent.h:115
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131
proxygen::HTTPEvent::HTTPEvent ( HTTPCodec::StreamID  streamID,
Type  event,
UpgradeProtocol  protocol 
)
inline

Definition at line 78 of file HTTPEvent.h.

79  :
80  streamID_(streamID), length_(0), event_(event),
81  upgrade_(false), protocol_(protocol) {}
UpgradeProtocol protocol_
Definition: HTTPEvent.h:120
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
uint32_t streamID
Definition: SPDYCodec.cpp:131

Member Function Documentation

std::unique_ptr<folly::IOBuf> proxygen::HTTPEvent::getBody ( )
inline

Definition at line 89 of file HTTPEvent.h.

References body_, and folly::gen::move.

89 { return std::move(body_); }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< folly::IOBuf > body_
Definition: HTTPEvent.h:113
size_t proxygen::HTTPEvent::getChunkLength ( ) const
inline

Definition at line 98 of file HTTPEvent.h.

References CHUNK_HEADER, event_, and length_.

std::unique_ptr<HTTPException> proxygen::HTTPEvent::getError ( )
inline

Definition at line 91 of file HTTPEvent.h.

References error_, and folly::gen::move.

91 { return std::move(error_); }
std::unique_ptr< HTTPException > error_
Definition: HTTPEvent.h:115
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Type proxygen::HTTPEvent::getEvent ( ) const
inline

Definition at line 83 of file HTTPEvent.h.

References event_.

Referenced by proxygen::HTTPTransaction::resumeIngress().

83 { return event_; }
std::unique_ptr<HTTPMessage> proxygen::HTTPEvent::getHeaders ( )
inline

Definition at line 87 of file HTTPEvent.h.

References headers_, and folly::gen::move.

87 { return std::move(headers_); }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< HTTPMessage > headers_
Definition: HTTPEvent.h:112
HTTPCodec::StreamID proxygen::HTTPEvent::getStreamID ( ) const
inline

Definition at line 85 of file HTTPEvent.h.

References streamID_.

85 { return streamID_; }
HTTPCodec::StreamID streamID_
Definition: HTTPEvent.h:116
std::unique_ptr<HTTPHeaders> proxygen::HTTPEvent::getTrailers ( )
inline

Definition at line 103 of file HTTPEvent.h.

References folly::gen::move, and trailers_.

103  {
104  return std::move(trailers_);
105  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPEvent.h:114
UpgradeProtocol proxygen::HTTPEvent::getUpgradeProtocol ( )
inline

Definition at line 107 of file HTTPEvent.h.

References protocol_.

107  {
108  return protocol_;
109  }
UpgradeProtocol protocol_
Definition: HTTPEvent.h:120
bool proxygen::HTTPEvent::isUpgrade ( ) const
inline

Definition at line 93 of file HTTPEvent.h.

References event_, MESSAGE_COMPLETE, and upgrade_.

Member Data Documentation

std::unique_ptr<folly::IOBuf> proxygen::HTTPEvent::body_
private

Definition at line 113 of file HTTPEvent.h.

Referenced by getBody().

std::unique_ptr<HTTPException> proxygen::HTTPEvent::error_
private

Definition at line 115 of file HTTPEvent.h.

Referenced by getError().

Type proxygen::HTTPEvent::event_
private

Definition at line 118 of file HTTPEvent.h.

Referenced by getChunkLength(), getEvent(), and isUpgrade().

std::unique_ptr<HTTPMessage> proxygen::HTTPEvent::headers_
private

Definition at line 112 of file HTTPEvent.h.

Referenced by getHeaders().

size_t proxygen::HTTPEvent::length_
private

Definition at line 117 of file HTTPEvent.h.

Referenced by getChunkLength().

UpgradeProtocol proxygen::HTTPEvent::protocol_
private

Definition at line 120 of file HTTPEvent.h.

Referenced by getUpgradeProtocol().

HTTPCodec::StreamID proxygen::HTTPEvent::streamID_
private

Definition at line 116 of file HTTPEvent.h.

Referenced by getStreamID().

std::unique_ptr<HTTPHeaders> proxygen::HTTPEvent::trailers_
private

Definition at line 114 of file HTTPEvent.h.

Referenced by getTrailers().

bool proxygen::HTTPEvent::upgrade_
private

Definition at line 119 of file HTTPEvent.h.

Referenced by isUpgrade().


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