proxygen
proxygen::TestStreamingCallback Class Reference

#include <TestStreamingCallback.h>

Inheritance diagram for proxygen::TestStreamingCallback:
proxygen::HPACK::StreamingCallback

Public Member Functions

void onHeader (const folly::fbstring &name, const folly::fbstring &value) override
 
void onHeadersComplete (HTTPHeaderSize) override
 
void onDecodeError (HPACK::DecodeError decodeError) override
 
void reset ()
 
folly::Expected< HeaderDecodeResult, HPACK::DecodeErrorgetResult ()
 
bool hasError () const
 
std::unique_ptr< std::vector< HPACKHeader > > hpackHeaders () const
 
char * duplicate (const folly::fbstring &str)
 
- Public Member Functions inherited from proxygen::HPACK::StreamingCallback
virtual ~StreamingCallback ()
 

Public Attributes

compress::HeaderPieceList headers
 
HPACK::DecodeError error {HPACK::DecodeError::NONE}
 
folly::Function< void()> headersCompleteCb
 
- Public Attributes inherited from proxygen::HPACK::StreamingCallback
HeaderCodec::Statsstats {nullptr}
 

Detailed Description

Definition at line 18 of file TestStreamingCallback.h.

Member Function Documentation

char* proxygen::TestStreamingCallback::duplicate ( const folly::fbstring str)
inline

Definition at line 64 of file TestStreamingCallback.h.

References folly::basic_fbstring< E, T, A, Storage >::data(), and folly::basic_fbstring< E, T, A, Storage >::length().

Referenced by onHeader().

64  {
65  char* res = CHECK_NOTNULL(new char[str.length() + 1]);
66  memcpy(res, str.data(), str.length() + 1);
67  return res;
68  }
const value_type * data() const
Definition: FBString.h:1716
size_type length() const
Definition: FBString.h:1341
folly::Expected<HeaderDecodeResult, HPACK::DecodeError> proxygen::TestStreamingCallback::getResult ( )
inline

Definition at line 39 of file TestStreamingCallback.h.

References error, headers, folly::makeUnexpected(), and proxygen::HPACK::NONE.

Referenced by isLowercase(), and TEST_F().

39  {
41  return HeaderDecodeResult{headers, 0};
42  } else {
44  }
45  }
constexpr Unexpected< typename std::decay< Error >::type > makeUnexpected(Error &&)
Definition: Expected.h:785
compress::HeaderPieceList headers
bool proxygen::TestStreamingCallback::hasError ( ) const
inline
std::unique_ptr<std::vector<HPACKHeader> > proxygen::TestStreamingCallback::hpackHeaders ( ) const
inline

Definition at line 51 of file TestStreamingCallback.h.

References hasError(), headers, and i.

Referenced by proxygen::hpack::decode(), and proxygen::hpack::encodeDecode().

51  {
52  CHECK(!hasError());
53  auto result = std::make_unique<std::vector<HPACKHeader>>();
54  for (size_t i = 0; i < headers.size(); i += 2) {
55  result->emplace_back(headers[i].str, headers[i + 1].str);
56  }
57 
58  return result;
59  }
compress::HeaderPieceList headers
void proxygen::TestStreamingCallback::onDecodeError ( HPACK::DecodeError  decodeError)
inlineoverridevirtual

Implements proxygen::HPACK::StreamingCallback.

Definition at line 30 of file TestStreamingCallback.h.

References error.

30  {
31  error = decodeError;
32  }
void proxygen::TestStreamingCallback::onHeader ( const folly::fbstring name,
const folly::fbstring value 
)
inlineoverridevirtual

Implements proxygen::HPACK::StreamingCallback.

Definition at line 20 of file TestStreamingCallback.h.

References duplicate(), headers, and folly::basic_fbstring< E, T, A, Storage >::size().

21  {
22  headers.emplace_back(duplicate(name), name.size(), true, false);
23  headers.emplace_back(duplicate(value), value.size(), true, false);
24  }
size_type size() const
Definition: FBString.h:1337
char * duplicate(const folly::fbstring &str)
compress::HeaderPieceList headers
void proxygen::TestStreamingCallback::onHeadersComplete ( HTTPHeaderSize  )
inlineoverridevirtual

Implements proxygen::HPACK::StreamingCallback.

Definition at line 25 of file TestStreamingCallback.h.

References headersCompleteCb.

25  {
26  if (headersCompleteCb) {
28  }
29  }
folly::Function< void()> headersCompleteCb
void proxygen::TestStreamingCallback::reset ( )
inline

Definition at line 34 of file TestStreamingCallback.h.

References error, headers, and proxygen::HPACK::NONE.

Referenced by TEST_F().

Member Data Documentation

HPACK::DecodeError proxygen::TestStreamingCallback::error {HPACK::DecodeError::NONE}

Definition at line 63 of file TestStreamingCallback.h.

Referenced by getResult(), hasError(), isLowercase(), onDecodeError(), and reset().

compress::HeaderPieceList proxygen::TestStreamingCallback::headers

Definition at line 62 of file TestStreamingCallback.h.

Referenced by getResult(), hpackHeaders(), onHeader(), and reset().

folly::Function<void()> proxygen::TestStreamingCallback::headersCompleteCb

Definition at line 70 of file TestStreamingCallback.h.

Referenced by onHeadersComplete().


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