proxygen
proxygen::FakeHTTPCodecCallback Class Reference

#include <TestUtils.h>

Inheritance diagram for proxygen::FakeHTTPCodecCallback:
proxygen::HTTPCodec::Callback

Public Member Functions

 FakeHTTPCodecCallback ()
 
void onMessageBegin (HTTPCodec::StreamID, HTTPMessage *) override
 
void onPushMessageBegin (HTTPCodec::StreamID, HTTPCodec::StreamID assocStream, HTTPMessage *) override
 
void onExMessageBegin (HTTPCodec::StreamID, HTTPCodec::StreamID controlStream, bool unidirectional, HTTPMessage *) override
 
void onHeadersComplete (HTTPCodec::StreamID stream, std::unique_ptr< HTTPMessage > inMsg) override
 
void onBody (HTTPCodec::StreamID, std::unique_ptr< folly::IOBuf > chain, uint16_t padding) override
 
void onChunkHeader (HTTPCodec::StreamID, size_t) override
 
void onChunkComplete (HTTPCodec::StreamID) override
 
void onTrailersComplete (HTTPCodec::StreamID, std::unique_ptr< HTTPHeaders > inTrailers) override
 
void onMessageComplete (HTTPCodec::StreamID, bool) override
 
void onError (HTTPCodec::StreamID stream, const HTTPException &error, bool) override
 
void onAbort (HTTPCodec::StreamID, ErrorCode code) override
 
void onFrameHeader (HTTPCodec::StreamID, uint8_t, uint64_t, uint8_t, uint16_t) override
 
void onGoaway (uint64_t lastStreamId, ErrorCode, std::unique_ptr< folly::IOBuf > debugData) override
 
void onPingRequest (uint64_t uniqueID) override
 
void onPingReply (uint64_t uniqueID) override
 
void onPriority (HTTPCodec::StreamID, const HTTPMessage::HTTPPriority &pri) override
 
void onWindowUpdate (HTTPCodec::StreamID stream, uint32_t amount) override
 
void onSettings (const SettingsList &inSettings) override
 
void onSettingsAck () override
 
void onCertificateRequest (uint16_t requestId, std::unique_ptr< folly::IOBuf > authRequest) override
 
void onCertificate (uint16_t certId, std::unique_ptr< folly::IOBuf > authenticator) override
 
bool onNativeProtocolUpgrade (HTTPCodec::StreamID, CodecProtocol, const std::string &, HTTPMessage &) override
 
uint32_t numOutgoingStreams () const override
 
uint32_t numIncomingStreams () const override
 
void expectMessage (bool eom, int32_t headerCount, const std::string &url) const
 
void expectMessage (bool eom, int32_t headerCount, int32_t statusCode) const
 
void expectMessageHelper (bool eom, int32_t headerCount, const std::string &url, int32_t statusCode) const
 
bool sessionError () const
 
std::function< bool()> getStopFn ()
 
void setSessionStreamId (HTTPCodec::StreamID streamId)
 
void reset ()
 
void dumpCounters (int verbosity) const
 
- Public Member Functions inherited from proxygen::HTTPCodec::Callback
virtual void onGenerateFrameHeader (StreamID, uint8_t, uint64_t, uint16_t=0)
 
virtual ~Callback ()
 

Public Attributes

HTTPCodec::StreamID headersCompleteId {0}
 
HTTPCodec::StreamID assocStreamId {0}
 
HTTPCodec::StreamID controlStreamId {0}
 
bool isUnidirectional {false}
 
HTTPCodec::StreamID sessionStreamId {0}
 
uint32_t messageBegin {0}
 
uint32_t headersComplete {0}
 
uint32_t messageComplete {0}
 
uint32_t bodyCalls {0}
 
uint32_t bodyLength {0}
 
uint32_t paddingBytes {0}
 
uint32_t chunkHeaders {0}
 
uint32_t chunkComplete {0}
 
uint32_t trailers {0}
 
uint32_t aborts {0}
 
uint32_t goaways {0}
 
uint32_t sessionErrors {0}
 
uint32_t streamErrors {0}
 
uint64_t recvPingRequest {0}
 
uint64_t recvPingReply {0}
 
uint32_t windowUpdateCalls {0}
 
uint32_t settings {0}
 
uint64_t numSettings {0}
 
uint32_t settingsAcks {0}
 
uint32_t certificateRequests {0}
 
uint16_t lastCertRequestId {0}
 
uint32_t certificates {0}
 
uint16_t lastCertId {0}
 
uint64_t windowSize {0}
 
uint64_t maxStreams {0}
 
uint32_t headerFrames {0}
 
HTTPMessage::HTTPPriority priority {0, false, 0}
 
std::map< proxygen::HTTPCodec::StreamID, std::vector< uint32_t > > windowUpdates
 
folly::IOBufQueue data
 
std::unique_ptr< HTTPMessagemsg
 
std::unique_ptr< HTTPExceptionlastParseError
 
ErrorCode lastErrorCode
 
std::vector< HTTPCodec::StreamIDgoawayStreamIds
 

Detailed Description

Definition at line 107 of file TestUtils.h.

Constructor & Destructor Documentation

proxygen::FakeHTTPCodecCallback::FakeHTTPCodecCallback ( )
inline

Definition at line 109 of file TestUtils.h.

109 {}

Member Function Documentation

void proxygen::FakeHTTPCodecCallback::dumpCounters ( int  verbosity) const
inline

Definition at line 337 of file TestUtils.h.

References aborts, assocStreamId, bodyCalls, bodyLength, certificateRequests, certificates, chunkComplete, chunkHeaders, controlStreamId, goaways, headerFrames, headersComplete, headersCompleteId, isUnidirectional, lastCertId, lastCertRequestId, maxStreams, messageBegin, paddingBytes, recvPingReply, recvPingRequest, sessionErrors, settings, settingsAcks, streamErrors, trailers, windowSize, and windowUpdateCalls.

337  {
338  VLOG(verbosity) << "Dumping HTTP codec callback counters";
339  VLOG(verbosity) << "headersCompleteId: " << headersCompleteId;
340  VLOG(verbosity) << "assocStreamId: " << assocStreamId;
341  VLOG(verbosity) << "controlStreamId: " << controlStreamId;
342  VLOG(verbosity) << "unidirectional: " << isUnidirectional;
343  VLOG(verbosity) << "messageBegin: " << messageBegin;
344  VLOG(verbosity) << "headersComplete: " << headersComplete;
345  VLOG(verbosity) << "bodyCalls: " << bodyCalls;
346  VLOG(verbosity) << "bodyLength: " << bodyLength;
347  VLOG(verbosity) << "paddingBytes: " << paddingBytes;
348  VLOG(verbosity) << "chunkHeaders: " << chunkHeaders;
349  VLOG(verbosity) << "chunkComplete: " << chunkComplete;
350  VLOG(verbosity) << "trailers: " << trailers;
351  VLOG(verbosity) << "aborts: " << aborts;
352  VLOG(verbosity) << "goaways: " << goaways;
353  VLOG(verbosity) << "sessionErrors: " << sessionErrors;
354  VLOG(verbosity) << "streamErrors: " << streamErrors;
355  VLOG(verbosity) << "recvPingRequest: " << recvPingRequest;
356  VLOG(verbosity) << "recvPingReply: " << recvPingReply;
357  VLOG(verbosity) << "windowUpdateCalls: " << windowUpdateCalls;
358  VLOG(verbosity) << "settings: " << settings;
359  VLOG(verbosity) << "settingsAcks: " << settingsAcks;
360  VLOG(verbosity) << "certificateRequests: " << certificateRequests;
361  VLOG(verbosity) << "lastCertRequestId: " << lastCertRequestId;
362  VLOG(verbosity) << "certificates: " << certificates;
363  VLOG(verbosity) << "lastCertId: " << lastCertId;
364  VLOG(verbosity) << "windowSize: " << windowSize;
365  VLOG(verbosity) << "maxStreams: " << maxStreams;
366  VLOG(verbosity) << "headerFrames: " << headerFrames;
367  }
int verbosity
Definition: upload.py:59
HTTPCodec::StreamID assocStreamId
Definition: TestUtils.h:370
HTTPCodec::StreamID headersCompleteId
Definition: TestUtils.h:369
HTTPCodec::StreamID controlStreamId
Definition: TestUtils.h:371
void proxygen::FakeHTTPCodecCallback::expectMessage ( bool  eom,
int32_t  headerCount,
const std::string url 
) const
inline

Definition at line 256 of file TestUtils.h.

References expectMessageHelper().

257  {
258  expectMessageHelper(eom, headerCount, url, -1);
259  }
void expectMessageHelper(bool eom, int32_t headerCount, const std::string &url, int32_t statusCode) const
Definition: TestUtils.h:265
void proxygen::FakeHTTPCodecCallback::expectMessage ( bool  eom,
int32_t  headerCount,
int32_t  statusCode 
) const
inline

Definition at line 260 of file TestUtils.h.

References expectMessageHelper().

261  {
262  expectMessageHelper(eom, headerCount, "", statusCode);
263  }
spdy::GoawayStatusCode statusCode
Definition: SPDYCodec.cpp:110
void expectMessageHelper(bool eom, int32_t headerCount, const std::string &url, int32_t statusCode) const
Definition: TestUtils.h:265
void proxygen::FakeHTTPCodecCallback::expectMessageHelper ( bool  eom,
int32_t  headerCount,
const std::string url,
int32_t  statusCode 
) const
inline

Definition at line 265 of file TestUtils.h.

References EXPECT_EQ, EXPECT_NE, headersComplete, messageBegin, messageComplete, msg, sessionErrors, statusCode, and streamErrors.

Referenced by expectMessage().

266  {
269  EXPECT_EQ(messageComplete, eom ? 1 : 0);
272  EXPECT_NE(msg, nullptr);
273  if (headerCount >= 0) {
274  EXPECT_EQ(msg->getHeaders().size(), headerCount);
275  }
276  if (!url.empty()) {
277  EXPECT_EQ(msg->getURL(), url);
278  } else if (statusCode > 0) {
279  if (msg->isResponse()) {
280  EXPECT_EQ(msg->getStatusCode(), statusCode);
281  } else {
282  EXPECT_EQ(msg->getPushStatusCode(), statusCode);
283  }
284  }
285  }
spdy::GoawayStatusCode statusCode
Definition: SPDYCodec.cpp:110
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
#define EXPECT_NE(val1, val2)
Definition: gtest.h:1926
std::unique_ptr< HTTPMessage > msg
Definition: TestUtils.h:404
std::function<bool()> proxygen::FakeHTTPCodecCallback::getStopFn ( )
inline

Definition at line 291 of file TestUtils.h.

References folly::netops::bind(), and sessionError().

Referenced by parseSPDY().

291  {
293  }
int bind(NetworkSocket s, const sockaddr *name, socklen_t namelen)
Definition: NetOps.cpp:76
uint32_t proxygen::FakeHTTPCodecCallback::numIncomingStreams ( ) const
inlineoverridevirtual

Return the number of open streams started by the remote side. Parallel codecs with a maximum number of streams will invoke this to determine if a new stream exceeds the limit.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 252 of file TestUtils.h.

References messageBegin.

252  {
253  return messageBegin;
254  }
uint32_t proxygen::FakeHTTPCodecCallback::numOutgoingStreams ( ) const
inlineoverridevirtual

Return the number of open streams started by this codec callback. Parallel codecs with a maximum number of streams will invoke this to determine if a new stream exceeds the limit.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 248 of file TestUtils.h.

248  {
249  return 0;
250  }
void proxygen::FakeHTTPCodecCallback::onAbort ( HTTPCodec::StreamID  ,
ErrorCode   
)
inlineoverridevirtual

Called when the peer has asked to shut down a stream immediately.

Parameters
streamThe stream ID
codeThe code the stream was aborted with
Note
Not applicable to all protocols.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 171 of file TestUtils.h.

References aborts, and lastErrorCode.

171  {
172  ++aborts;
173  lastErrorCode = code;
174  }
void proxygen::FakeHTTPCodecCallback::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 134 of file TestUtils.h.

References folly::IOBufQueue::append(), bodyCalls, bodyLength, folly::IOBuf::computeChainDataLength(), data, folly::gen::move, and paddingBytes.

136  {
137  bodyCalls++;
138  paddingBytes += padding;
140  data.append(std::move(chain));
141  }
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
Definition: IOBufQueue.cpp:143
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::size_t computeChainDataLength() const
Definition: IOBuf.cpp:501
void proxygen::FakeHTTPCodecCallback::onCertificate ( uint16_t  ,
std::unique_ptr< folly::IOBuf  
)
inlineoverridevirtual

Called upon receipt of an authenticator, for protocols that support secondary certificate authentication.

Parameters
certIdThe Cert-ID identifying this authenticator
authenticatorThe authenticator request
Note
Not all protocols support secondary certificate authentication. HTTP/2 does, but HTTP/1.1 doesn't.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 234 of file TestUtils.h.

References folly::IOBufQueue::append(), certificates, data, lastCertId, and folly::gen::move.

235  {
236  certificates++;
237  lastCertId = certId;
238  data.append(std::move(authenticator));
239  }
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
Definition: IOBufQueue.cpp:143
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void proxygen::FakeHTTPCodecCallback::onCertificateRequest ( uint16_t  ,
std::unique_ptr< folly::IOBuf  
)
inlineoverridevirtual

Called upon receipt of a certificate request frame, for protocols that support secondary certificate authentication.

Parameters
requestIdThe Request-ID identifying the certificate request
authRequestThe authenticator request
Note
Not all protocols support secondary certificate authentication. HTTP/2 does, but HTTP/1.1 doesn't.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 227 of file TestUtils.h.

References folly::IOBufQueue::append(), certificateRequests, data, lastCertRequestId, and folly::gen::move.

228  {
230  lastCertRequestId = requestId;
231  data.append(std::move(authRequest));
232  }
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
Definition: IOBufQueue.cpp:143
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void proxygen::FakeHTTPCodecCallback::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 146 of file TestUtils.h.

References chunkComplete.

146  {
147  chunkComplete++;
148  }
void proxygen::FakeHTTPCodecCallback::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 142 of file TestUtils.h.

References chunkHeaders.

143  {
144  chunkHeaders++;
145  }
void proxygen::FakeHTTPCodecCallback::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 160 of file TestUtils.h.

References folly::pushmi::operators::error(), lastParseError, sessionErrors, sessionStreamId, and streamErrors.

162  {
163  if (stream != sessionStreamId) {
164  streamErrors++;
165  } else {
166  sessionErrors++;
167  }
168  lastParseError = std::make_unique<HTTPException>(error);
169  }
std::unique_ptr< HTTPException > lastParseError
Definition: TestUtils.h:405
requires And< SemiMovable< VN >... > &&SemiMovable< E > auto error(E e)
Definition: error.h:48
HTTPCodec::StreamID sessionStreamId
Definition: TestUtils.h:373
void proxygen::FakeHTTPCodecCallback::onExMessageBegin ( HTTPCodec::StreamID  ,
HTTPCodec::StreamID  ,
bool  ,
HTTPMessage  
)
inlineoverridevirtual

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

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

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 120 of file TestUtils.h.

References controlStreamId, isUnidirectional, and messageBegin.

123  {
124  messageBegin++;
125  controlStreamId = controlStream;
126  isUnidirectional = unidirectional;
127  }
HTTPCodec::StreamID controlStreamId
Definition: TestUtils.h:371
void proxygen::FakeHTTPCodecCallback::onFrameHeader ( HTTPCodec::StreamID  ,
uint8_t  ,
uint64_t  ,
uint8_t  ,
uint16_t   
)
inlineoverridevirtual

Called upon receipt of a frame header.

Parameters
stream_idThe stream ID
flagsThe flags field of frame header
lengthThe length field of frame header
typeThe type field of frame header
versionThe version of frame (SPDY only)
Note
Not all protocols have frames. SPDY and HTTP/2 do, but HTTP/1.1 doesn't.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 176 of file TestUtils.h.

References headerFrames.

181  {
182  ++headerFrames;
183  }
void proxygen::FakeHTTPCodecCallback::onGoaway ( uint64_t  ,
ErrorCode  ,
std::unique_ptr< folly::IOBuf  
)
inlineoverridevirtual

Called upon receipt of a goaway.

Parameters
lastGoodStreamIDLast successful stream created by the receiver
codeThe code the connection was aborted with
debugDataThe additional debug data for diagnostic purpose
Note
Not all protocols have goaways. SPDY does, but HTTP/1.1 doesn't.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 185 of file TestUtils.h.

References folly::IOBufQueue::append(), data, goaways, goawayStreamIds, and folly::gen::move.

187  {
188  ++goaways;
189  goawayStreamIds.emplace_back(lastStreamId);
190  data.append(std::move(debugData));
191  }
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
Definition: IOBufQueue.cpp:143
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::vector< HTTPCodec::StreamID > goawayStreamIds
Definition: TestUtils.h:407
void proxygen::FakeHTTPCodecCallback::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 128 of file TestUtils.h.

References headersComplete, headersCompleteId, folly::gen::move, msg, and stream.

129  {
130  headersComplete++;
132  msg = std::move(inMsg);
133  }
StreamCodecFactory stream
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
HTTPCodec::StreamID headersCompleteId
Definition: TestUtils.h:369
void proxygen::FakeHTTPCodecCallback::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 111 of file TestUtils.h.

References messageBegin.

111  {
112  messageBegin++;
113  }
void proxygen::FakeHTTPCodecCallback::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 156 of file TestUtils.h.

References messageComplete.

157  {
158  messageComplete++;
159  }
bool proxygen::FakeHTTPCodecCallback::onNativeProtocolUpgrade ( HTTPCodec::StreamID  ,
CodecProtocol  ,
const std::string ,
HTTPMessage  
)
inlineoverridevirtual

Called upon receipt of a valid protocol switch. Return false if protocol switch could not be completed.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 241 of file TestUtils.h.

244  {
245  return true;
246  }
void proxygen::FakeHTTPCodecCallback::onPingReply ( uint64_t  )
inlineoverridevirtual

Called upon receipt of a ping reply

Parameters
uniqueIDUnique identifier for the ping
Note
Not all protocols have pings. SPDY does, but HTTP/1.1 doesn't.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 197 of file TestUtils.h.

References recvPingReply.

197  {
198  recvPingReply = uniqueID;
199  }
void proxygen::FakeHTTPCodecCallback::onPingRequest ( uint64_t  )
inlineoverridevirtual

Called upon receipt of a ping request

Parameters
uniqueIDUnique identifier for the ping
Note
Not all protocols have pings. SPDY does, but HTTP/1.1 doesn't.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 193 of file TestUtils.h.

References recvPingRequest.

193  {
194  recvPingRequest = uniqueID;
195  }
void proxygen::FakeHTTPCodecCallback::onPriority ( HTTPCodec::StreamID  ,
const HTTPMessage::HTTPPriority  
)
inlineoverridevirtual

Called upon receipt of a priority frame, for protocols that support dynamic priority

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 201 of file TestUtils.h.

References priority.

202  {
203  priority = pri;
204  }
HTTPMessage::HTTPPriority priority
Definition: TestUtils.h:400
void proxygen::FakeHTTPCodecCallback::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 114 of file TestUtils.h.

References assocStreamId, and messageBegin.

116  {
117  messageBegin++;
118  assocStreamId = assocStream;
119  }
HTTPCodec::StreamID assocStreamId
Definition: TestUtils.h:370
void proxygen::FakeHTTPCodecCallback::onSettings ( const SettingsList )
inlineoverridevirtual

Called upon receipt of a settings frame, for protocols that support settings.

Parameters
settingsa list of settings that were sent in the settings frame

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 211 of file TestUtils.h.

References proxygen::INITIAL_WINDOW_SIZE, proxygen::MAX_CONCURRENT_STREAMS, maxStreams, numSettings, settings, and windowSize.

211  {
212  settings++;
213  numSettings += inSettings.size();
214  for (auto& setting: inSettings) {
215  if (setting.id == SettingsId::INITIAL_WINDOW_SIZE) {
216  windowSize = setting.value;
217  } else if (setting.id == SettingsId::MAX_CONCURRENT_STREAMS) {
218  maxStreams = setting.value;
219  }
220  }
221  }
void proxygen::FakeHTTPCodecCallback::onSettingsAck ( )
inlineoverridevirtual

Called upon receipt of a settings frame with ACK set, for protocols that support settings ack.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 223 of file TestUtils.h.

References settingsAcks.

223  {
224  settingsAcks++;
225  }
void proxygen::FakeHTTPCodecCallback::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 149 of file TestUtils.h.

References folly::gen::move, msg, and trailers.

150  {
151  trailers++;
152  if (msg) {
153  msg->setTrailers(std::move(inTrailers));
154  }
155  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::unique_ptr< HTTPMessage > msg
Definition: TestUtils.h:404
void proxygen::FakeHTTPCodecCallback::onWindowUpdate ( HTTPCodec::StreamID  ,
uint32_t   
)
inlineoverridevirtual

Called upon receipt of a window update, for protocols that support flow control. For instance spdy/3 and higher.

Reimplemented from proxygen::HTTPCodec::Callback.

Definition at line 206 of file TestUtils.h.

References stream, windowUpdateCalls, and windowUpdates.

206  {
208  windowUpdates[stream].push_back(amount);
209  }
StreamCodecFactory stream
std::map< proxygen::HTTPCodec::StreamID, std::vector< uint32_t > > windowUpdates
Definition: TestUtils.h:401
void proxygen::FakeHTTPCodecCallback::reset ( )
inline

Definition at line 299 of file TestUtils.h.

References aborts, assocStreamId, bodyCalls, bodyLength, certificateRequests, certificates, chunkComplete, chunkHeaders, controlStreamId, data, goaways, headerFrames, headersComplete, headersCompleteId, isUnidirectional, lastCertId, lastCertRequestId, lastErrorCode, lastParseError, maxStreams, messageBegin, messageComplete, folly::IOBufQueue::move(), msg, proxygen::NO_ERROR, paddingBytes, priority, recvPingReply, recvPingRequest, sessionErrors, settings, settingsAcks, streamErrors, trailers, windowSize, windowUpdateCalls, and windowUpdates.

Referenced by TEST().

299  {
300  headersCompleteId = 0;
301  assocStreamId = 0;
302  controlStreamId = 0;
303  isUnidirectional = false;
304  messageBegin = 0;
305  headersComplete = 0;
306  messageComplete = 0;
307  bodyCalls = 0;
308  bodyLength = 0;
309  paddingBytes = 0;
310  chunkHeaders = 0;
311  chunkComplete = 0;
312  trailers = 0;
313  aborts = 0;
314  goaways = 0;
315  sessionErrors = 0;
316  streamErrors = 0;
317  recvPingRequest = 0;
318  recvPingReply = 0;
319  windowUpdateCalls = 0;
320  settings = 0;
321  settingsAcks = 0;
323  lastCertRequestId = 0;
324  certificates = 0;
325  lastCertId = 0;
326  windowSize = 0;
327  maxStreams = 0;
328  headerFrames = 0;
329  priority = HTTPMessage::HTTPPriority(0, false, 0);
330  windowUpdates.clear();
331  data.move();
332  msg.reset();
333  lastParseError.reset();
335  }
HTTPCodec::StreamID assocStreamId
Definition: TestUtils.h:370
std::unique_ptr< HTTPException > lastParseError
Definition: TestUtils.h:405
std::unique_ptr< folly::IOBuf > move()
Definition: IOBufQueue.h:459
HTTPCodec::StreamID headersCompleteId
Definition: TestUtils.h:369
std::map< proxygen::HTTPCodec::StreamID, std::vector< uint32_t > > windowUpdates
Definition: TestUtils.h:401
std::tuple< uint32_t, bool, uint8_t > HTTPPriority
Definition: HTTPMessage.h:592
HTTPCodec::StreamID controlStreamId
Definition: TestUtils.h:371
std::unique_ptr< HTTPMessage > msg
Definition: TestUtils.h:404
HTTPMessage::HTTPPriority priority
Definition: TestUtils.h:400
bool proxygen::FakeHTTPCodecCallback::sessionError ( ) const
inline

Definition at line 287 of file TestUtils.h.

References sessionErrors.

Referenced by getStopFn().

287  {
288  return sessionErrors > 0;
289  }
void proxygen::FakeHTTPCodecCallback::setSessionStreamId ( HTTPCodec::StreamID  streamId)
inline

Definition at line 295 of file TestUtils.h.

References sessionStreamId.

295  {
296  sessionStreamId = streamId;
297  }
HTTPCodec::StreamID sessionStreamId
Definition: TestUtils.h:373

Member Data Documentation

uint32_t proxygen::FakeHTTPCodecCallback::aborts {0}

Definition at line 383 of file TestUtils.h.

Referenced by dumpCounters(), onAbort(), and reset().

HTTPCodec::StreamID proxygen::FakeHTTPCodecCallback::assocStreamId {0}

Definition at line 370 of file TestUtils.h.

Referenced by dumpCounters(), onPushMessageBegin(), reset(), and TEST().

uint32_t proxygen::FakeHTTPCodecCallback::bodyCalls {0}

Definition at line 377 of file TestUtils.h.

Referenced by dumpCounters(), onBody(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::bodyLength {0}

Definition at line 378 of file TestUtils.h.

Referenced by dumpCounters(), onBody(), reset(), and TEST().

uint32_t proxygen::FakeHTTPCodecCallback::certificateRequests {0}

Definition at line 393 of file TestUtils.h.

Referenced by dumpCounters(), onCertificateRequest(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::certificates {0}

Definition at line 395 of file TestUtils.h.

Referenced by dumpCounters(), onCertificate(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::chunkComplete {0}

Definition at line 381 of file TestUtils.h.

Referenced by dumpCounters(), onChunkComplete(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::chunkHeaders {0}

Definition at line 380 of file TestUtils.h.

Referenced by dumpCounters(), onChunkHeader(), and reset().

HTTPCodec::StreamID proxygen::FakeHTTPCodecCallback::controlStreamId {0}

Definition at line 371 of file TestUtils.h.

Referenced by dumpCounters(), onExMessageBegin(), and reset().

folly::IOBufQueue proxygen::FakeHTTPCodecCallback::data

Definition at line 402 of file TestUtils.h.

Referenced by onBody(), onCertificate(), onCertificateRequest(), onGoaway(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::goaways {0}

Definition at line 384 of file TestUtils.h.

Referenced by dumpCounters(), onGoaway(), reset(), and TEST().

std::vector<HTTPCodec::StreamID> proxygen::FakeHTTPCodecCallback::goawayStreamIds

Definition at line 407 of file TestUtils.h.

Referenced by onGoaway().

uint32_t proxygen::FakeHTTPCodecCallback::headerFrames {0}

Definition at line 399 of file TestUtils.h.

Referenced by dumpCounters(), onFrameHeader(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::headersComplete {0}

Definition at line 375 of file TestUtils.h.

Referenced by dumpCounters(), expectMessageHelper(), onHeadersComplete(), reset(), and TEST().

HTTPCodec::StreamID proxygen::FakeHTTPCodecCallback::headersCompleteId {0}

Definition at line 369 of file TestUtils.h.

Referenced by dumpCounters(), onHeadersComplete(), and reset().

bool proxygen::FakeHTTPCodecCallback::isUnidirectional {false}

Definition at line 372 of file TestUtils.h.

Referenced by dumpCounters(), onExMessageBegin(), and reset().

uint16_t proxygen::FakeHTTPCodecCallback::lastCertId {0}

Definition at line 396 of file TestUtils.h.

Referenced by dumpCounters(), onCertificate(), and reset().

uint16_t proxygen::FakeHTTPCodecCallback::lastCertRequestId {0}

Definition at line 394 of file TestUtils.h.

Referenced by dumpCounters(), onCertificateRequest(), and reset().

ErrorCode proxygen::FakeHTTPCodecCallback::lastErrorCode

Definition at line 406 of file TestUtils.h.

Referenced by onAbort(), and reset().

std::unique_ptr<HTTPException> proxygen::FakeHTTPCodecCallback::lastParseError

Definition at line 405 of file TestUtils.h.

Referenced by onError(), reset(), and TEST().

uint64_t proxygen::FakeHTTPCodecCallback::maxStreams {0}

Definition at line 398 of file TestUtils.h.

Referenced by dumpCounters(), onSettings(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::messageBegin {0}
uint32_t proxygen::FakeHTTPCodecCallback::messageComplete {0}

Definition at line 376 of file TestUtils.h.

Referenced by expectMessageHelper(), onMessageComplete(), reset(), and TEST().

std::unique_ptr<HTTPMessage> proxygen::FakeHTTPCodecCallback::msg
uint64_t proxygen::FakeHTTPCodecCallback::numSettings {0}

Definition at line 391 of file TestUtils.h.

Referenced by onSettings().

uint32_t proxygen::FakeHTTPCodecCallback::paddingBytes {0}

Definition at line 379 of file TestUtils.h.

Referenced by dumpCounters(), onBody(), and reset().

HTTPMessage::HTTPPriority proxygen::FakeHTTPCodecCallback::priority {0, false, 0}

Definition at line 400 of file TestUtils.h.

Referenced by proxygen::MATCHER_P(), onPriority(), and reset().

uint64_t proxygen::FakeHTTPCodecCallback::recvPingReply {0}

Definition at line 388 of file TestUtils.h.

Referenced by dumpCounters(), onPingReply(), reset(), and TEST().

uint64_t proxygen::FakeHTTPCodecCallback::recvPingRequest {0}

Definition at line 387 of file TestUtils.h.

Referenced by dumpCounters(), onPingRequest(), reset(), and TEST().

uint32_t proxygen::FakeHTTPCodecCallback::sessionErrors {0}
HTTPCodec::StreamID proxygen::FakeHTTPCodecCallback::sessionStreamId {0}

Definition at line 373 of file TestUtils.h.

Referenced by onError(), and setSessionStreamId().

uint32_t proxygen::FakeHTTPCodecCallback::settings {0}

Definition at line 390 of file TestUtils.h.

Referenced by dumpCounters(), onSettings(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::settingsAcks {0}

Definition at line 392 of file TestUtils.h.

Referenced by dumpCounters(), onSettingsAck(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::streamErrors {0}
uint32_t proxygen::FakeHTTPCodecCallback::trailers {0}

Definition at line 382 of file TestUtils.h.

Referenced by dumpCounters(), onTrailersComplete(), and reset().

uint64_t proxygen::FakeHTTPCodecCallback::windowSize {0}

Definition at line 397 of file TestUtils.h.

Referenced by dumpCounters(), onSettings(), and reset().

uint32_t proxygen::FakeHTTPCodecCallback::windowUpdateCalls {0}

Definition at line 389 of file TestUtils.h.

Referenced by dumpCounters(), onWindowUpdate(), and reset().

std::map<proxygen::HTTPCodec::StreamID, std::vector<uint32_t> > proxygen::FakeHTTPCodecCallback::windowUpdates

Definition at line 401 of file TestUtils.h.

Referenced by onWindowUpdate(), and reset().


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