proxygen
HTTP1xCodecCallback Class Reference
Inheritance diagram for HTTP1xCodecCallback:
proxygen::HTTPCodec::Callback

Public Member Functions

 HTTP1xCodecCallback ()
 
void onMessageBegin (HTTPCodec::StreamID, HTTPMessage *) override
 
void onPushMessageBegin (HTTPCodec::StreamID, HTTPCodec::StreamID, HTTPMessage *) override
 
void onHeadersComplete (HTTPCodec::StreamID, std::unique_ptr< HTTPMessage > msg) override
 
void onBody (HTTPCodec::StreamID, std::unique_ptr< folly::IOBuf > chain, uint16_t) override
 
void onChunkHeader (HTTPCodec::StreamID, size_t) override
 
void onChunkComplete (HTTPCodec::StreamID) override
 
void onTrailersComplete (HTTPCodec::StreamID, std::unique_ptr< HTTPHeaders >) override
 
void onMessageComplete (HTTPCodec::StreamID, bool) override
 
void onError (HTTPCodec::StreamID, const HTTPException &, bool) override
 
- Public Member Functions inherited from proxygen::HTTPCodec::Callback
virtual void onExMessageBegin (StreamID, StreamID, bool, HTTPMessage *)
 
virtual void onAbort (StreamID, ErrorCode)
 
virtual void onFrameHeader (StreamID, uint8_t, uint64_t, uint8_t, uint16_t=0)
 
virtual void onGoaway (uint64_t, ErrorCode, std::unique_ptr< folly::IOBuf >=nullptr)
 
virtual void onPingRequest (uint64_t)
 
virtual void onPingReply (uint64_t)
 
virtual void onWindowUpdate (StreamID, uint32_t)
 
virtual void onSettings (const SettingsList &)
 
virtual void onSettingsAck ()
 
virtual void onPriority (StreamID, const HTTPMessage::HTTPPriority &)
 
virtual bool onNativeProtocolUpgrade (StreamID, CodecProtocol, const std::string &, HTTPMessage &)
 
virtual void onGenerateFrameHeader (StreamID, uint8_t, uint64_t, uint16_t=0)
 
virtual void onCertificateRequest (uint16_t, std::unique_ptr< folly::IOBuf >)
 
virtual void onCertificate (uint16_t, std::unique_ptr< folly::IOBuf >)
 
virtual uint32_t numOutgoingStreams () const
 
virtual uint32_t numIncomingStreams () const
 
virtual ~Callback ()
 

Public Attributes

uint32_t headersComplete {0}
 
uint32_t messageComplete {0}
 
uint32_t errors {0}
 
uint32_t bodyLen {0}
 
HTTPHeaderSize headerSize
 
std::unique_ptr< HTTPMessagemsg_
 

Detailed Description

Definition at line 22 of file HTTP1xCodecTest.cpp.

Constructor & Destructor Documentation

HTTP1xCodecCallback::HTTP1xCodecCallback ( )
inline

Definition at line 24 of file HTTP1xCodecTest.cpp.

24 {}

Member Function Documentation

void HTTP1xCodecCallback::onBody ( HTTPCodec::StreamID  stream,
std::unique_ptr< folly::IOBuf chain,
uint16_t  padding 
)
inlineoverridevirtual

Called for each block of message body data

Parameters
streamThe stream ID
chainOne or more buffers of body data. The codec will remove any protocol framing, such as HTTP/1.1 chunk headers, from the buffers before calling this function.
paddingNumber of pad bytes that came with the data segment

Implements proxygen::HTTPCodec::Callback.

Definition at line 37 of file HTTP1xCodecTest.cpp.

References folly::IOBuf::computeChainDataLength().

39  {
40  bodyLen += chain->computeChainDataLength();
41  }
std::size_t computeChainDataLength() const
Definition: IOBuf.cpp:501
void HTTP1xCodecCallback::onChunkComplete ( HTTPCodec::StreamID  )
inlineoverridevirtual

Called when the terminating CRLF is received to end a chunk of HTTP body data.

Parameters
streamThe stream ID

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 44 of file HTTP1xCodecTest.cpp.

44 {}
void HTTP1xCodecCallback::onChunkHeader ( HTTPCodec::StreamID  ,
size_t   
)
inlineoverridevirtual

Called for each HTTP chunk header.

onChunkHeader() will be called when the chunk header is received. As the chunk data arrives, it will be passed to the callback normally with onBody() calls. Note that the chunk data may arrive in multiple onBody() calls: it is not guaranteed to arrive in a single onBody() call.

After the chunk data has been received and the terminating CRLF has been received, onChunkComplete() will be called.

Parameters
streamThe stream ID
lengthThe chunk length.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 42 of file HTTP1xCodecTest.cpp.

43  {}
void HTTP1xCodecCallback::onError ( HTTPCodec::StreamID  stream,
const HTTPException error,
bool  newTxn 
)
inlineoverridevirtual

Called when a parsing or protocol error has occurred

Parameters
streamThe stream ID
errorDescription of the error
newTxntrue if onMessageBegin has not been called for txn

Implements proxygen::HTTPCodec::Callback.

Definition at line 51 of file HTTP1xCodecTest.cpp.

References proxygen::ERROR.

53  {
54  ++errors;
55  LOG(ERROR) << "parse error";
56  }
void HTTP1xCodecCallback::onHeadersComplete ( HTTPCodec::StreamID  stream,
std::unique_ptr< HTTPMessage msg 
)
inlineoverridevirtual

Called when all the headers of an ingress message have been parsed

Parameters
streamThe stream ID
msgThe message
sizeSize of the ingress header

Implements proxygen::HTTPCodec::Callback.

Definition at line 31 of file HTTP1xCodecTest.cpp.

References proxygen::HTTPMessage::getIngressHeaderSize(), folly::recordio_helpers::headerSize(), and folly::gen::move.

32  {
35  msg_ = std::move(msg);
36  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
const HTTPHeaderSize & getIngressHeaderSize() const
Definition: HTTPMessage.h:615
HTTPHeaderSize headerSize
std::unique_ptr< HTTPMessage > msg_
void HTTP1xCodecCallback::onMessageBegin ( HTTPCodec::StreamID  stream,
HTTPMessage msg 
)
inlineoverridevirtual

Called when a new message is seen while parsing the ingress

Parameters
streamThe stream ID
msgA newly allocated HTTPMessage

Implements proxygen::HTTPCodec::Callback.

Definition at line 26 of file HTTP1xCodecTest.cpp.

27  {}
void HTTP1xCodecCallback::onMessageComplete ( HTTPCodec::StreamID  stream,
bool  upgrade 
)
inlineoverridevirtual

Called at end of a message (including body and trailers, if applicable)

Parameters
streamThe stream ID
upgradeWhether the connection has been upgraded to another protocol.

Implements proxygen::HTTPCodec::Callback.

Definition at line 47 of file HTTP1xCodecTest.cpp.

48  {
50  }
void HTTP1xCodecCallback::onPushMessageBegin ( HTTPCodec::StreamID  ,
HTTPCodec::StreamID  ,
HTTPMessage  
)
inlineoverridevirtual

Called when a new push message is seen while parsing the ingress.

Parameters
streamThe stream ID
assocStreamThe stream ID of the associated stream, which can never be 0
msgA newly allocated HTTPMessage

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 28 of file HTTP1xCodecTest.cpp.

30  {}
void HTTP1xCodecCallback::onTrailersComplete ( HTTPCodec::StreamID  stream,
std::unique_ptr< HTTPHeaders trailers 
)
inlineoverridevirtual

Called when all the trailers of an ingress message have been parsed, but only if the number of trailers is nonzero.

Parameters
streamThe stream ID
trailersThe message trailers

Implements proxygen::HTTPCodec::Callback.

Definition at line 45 of file HTTP1xCodecTest.cpp.

46  {}

Member Data Documentation

uint32_t HTTP1xCodecCallback::bodyLen {0}

Definition at line 61 of file HTTP1xCodecTest.cpp.

Referenced by TEST().

uint32_t HTTP1xCodecCallback::errors {0}

Definition at line 60 of file HTTP1xCodecTest.cpp.

Referenced by TEST().

uint32_t HTTP1xCodecCallback::headersComplete {0}

Definition at line 58 of file HTTP1xCodecTest.cpp.

Referenced by TEST(), and TEST_P().

HTTPHeaderSize HTTP1xCodecCallback::headerSize

Definition at line 62 of file HTTP1xCodecTest.cpp.

Referenced by TEST().

uint32_t HTTP1xCodecCallback::messageComplete {0}

Definition at line 59 of file HTTP1xCodecTest.cpp.

Referenced by TEST().

std::unique_ptr<HTTPMessage> HTTP1xCodecCallback::msg_

Definition at line 63 of file HTTP1xCodecTest.cpp.

Referenced by TEST(), and TEST_P().


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