proxygen
proxygen::DefaultHTTPCodecFactory Class Reference

#include <DefaultHTTPCodecFactory.h>

Inheritance diagram for proxygen::DefaultHTTPCodecFactory:
proxygen::HTTPCodecFactory

Public Member Functions

 DefaultHTTPCodecFactory (bool forceHTTP1xCodecTo1_1)
 
 ~DefaultHTTPCodecFactory () override=default
 
std::unique_ptr< HTTPCodecgetCodec (const std::string &nextProtocol, TransportDirection direction, bool isTLS) override
 
void setForceHTTP1xCodecTo1_1 (bool forceHTTP1xCodecTo1_1)
 
- Public Member Functions inherited from proxygen::HTTPCodecFactory
 HTTPCodecFactory ()
 
virtual ~HTTPCodecFactory ()
 

Protected Attributes

bool forceHTTP1xCodecTo1_1_ {false}
 

Additional Inherited Members

- Static Public Member Functions inherited from proxygen::HTTPCodecFactory
static std::unique_ptr< HTTPCodecgetCodec (CodecProtocol protocol, TransportDirection direction)
 

Detailed Description

Definition at line 15 of file DefaultHTTPCodecFactory.h.

Constructor & Destructor Documentation

proxygen::DefaultHTTPCodecFactory::DefaultHTTPCodecFactory ( bool  forceHTTP1xCodecTo1_1)
explicit

Definition at line 19 of file DefaultHTTPCodecFactory.cpp.

21  : forceHTTP1xCodecTo1_1_(forceHTTP1xCodecTo1_1) {
22 }
proxygen::DefaultHTTPCodecFactory::~DefaultHTTPCodecFactory ( )
overridedefault

Member Function Documentation

std::unique_ptr< HTTPCodec > proxygen::DefaultHTTPCodecFactory::getCodec ( const std::string nextProtocol,
TransportDirection  direction,
bool  isTLS 
)
overridevirtual

Get a codec instance

Implements proxygen::HTTPCodecFactory.

Definition at line 24 of file DefaultHTTPCodecFactory.cpp.

References proxygen::ERROR, forceHTTP1xCodecTo1_1_, proxygen::SPDYCodec::getVersion(), proxygen::http2::kProtocolCleartextString, proxygen::http2::kProtocolDraftString, proxygen::http2::kProtocolExperimentalString, proxygen::http2::kProtocolString, and proxygen::HTTP1xCodec::supportsNextProtocol().

Referenced by TEST().

27  {
28 
29  auto spdyVersion = SPDYCodec::getVersion(chosenProto);
30  if (spdyVersion) {
31  return std::make_unique<SPDYCodec>(direction,
32  *spdyVersion);
33  } else if (chosenProto == proxygen::http2::kProtocolString ||
37  return std::make_unique<HTTP2Codec>(direction);
38  } else {
39  if (!chosenProto.empty() &&
40  !HTTP1xCodec::supportsNextProtocol(chosenProto)) {
41  LOG(ERROR) << "Chosen upstream protocol " <<
42  "\"" << chosenProto << "\" is unimplemented. " <<
43  "Attempting to use HTTP/1.1";
44  }
45 
46  return std::make_unique<HTTP1xCodec>(direction,
48  }
49 }
uint8_t getVersion() const
Definition: SPDYCodec.cpp:1023
const std::string kProtocolCleartextString
const std::string kProtocolString
static bool supportsNextProtocol(const std::string &npn)
const std::string kProtocolDraftString
const std::string kProtocolExperimentalString
void proxygen::DefaultHTTPCodecFactory::setForceHTTP1xCodecTo1_1 ( bool  forceHTTP1xCodecTo1_1)
inline

Definition at line 27 of file DefaultHTTPCodecFactory.h.

References forceHTTP1xCodecTo1_1_.

27  {
28  forceHTTP1xCodecTo1_1_ = forceHTTP1xCodecTo1_1;
29  }

Member Data Documentation

bool proxygen::DefaultHTTPCodecFactory::forceHTTP1xCodecTo1_1_ {false}
protected

Definition at line 31 of file DefaultHTTPCodecFactory.h.

Referenced by getCodec(), and setForceHTTP1xCodecTo1_1().


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