MCPcopy Create free account
hub / github.com/apache/brpc / ALPNProtocolToString

Function ALPNProtocolToString

src/brpc/details/ssl_helper.cpp:948–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

946}
947
948std::string ALPNProtocolToString(const AdaptiveProtocolType& protocol) {
949 butil::StringPiece name = protocol.name();
950 // Default use http 1.1 version
951 if (name.starts_with("http")) {
952 name.set("http/1.1");
953 }
954
955 // ALPN extension uses 1 byte to record the protocol length
956 // and it's maximum length is 255.
957 if (name.size() > CHAR_MAX) {
958 name = name.substr(0, CHAR_MAX);
959 }
960
961 char length = static_cast<char>(name.size());
962 return std::string(&length, 1) + name.data();
963}
964
965bool BuildALPNProtocolList(
966 const std::vector<std::string>& alpn_protocols,

Callers 2

HandshakeWithServerMethod · 0.85
InitALPNOptionsMethod · 0.85

Calls 6

starts_withMethod · 0.80
substrMethod · 0.80
nameMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

HandshakeWithServerMethod · 0.68