proxygen
HTTPCodecFactory.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
14 
15 namespace proxygen {
16 
17 std::unique_ptr<HTTPCodec> HTTPCodecFactory::getCodec(
18  CodecProtocol protocol, TransportDirection direction) {
19  switch (protocol) {
21  return std::make_unique<HTTP1xCodec>(direction);
23  return std::make_unique<SPDYCodec>(direction, SPDYVersion::SPDY3);
25  return std::make_unique<SPDYCodec>(direction, SPDYVersion::SPDY3_1);
27  return std::make_unique<HTTP2Codec>(direction);
28  default:
29  LOG(FATAL) << "Unreachable";
30  return nullptr;
31  }
32 }
33 
34 }
virtual std::unique_ptr< HTTPCodec > getCodec(const std::string &protocolHint, TransportDirection direction, bool isTLS)=0