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

Function FillUnresolvedPath

src/brpc/policy/http_rpc_protocol.cpp:1063–1086  ·  view source on GitHub ↗

Normalize the sub string of `uri_path' covered by `splitter' and put it into `unresolved_path'

Source from the content-addressed store, hash-verified

1061// Normalize the sub string of `uri_path' covered by `splitter' and
1062// put it into `unresolved_path'
1063static void FillUnresolvedPath(std::string* unresolved_path,
1064 const std::string& uri_path,
1065 butil::StringSplitter& splitter) {
1066 if (unresolved_path == NULL) {
1067 return;
1068 }
1069 if (!splitter) {
1070 unresolved_path->clear();
1071 return;
1072 }
1073 // Normalize unresolve_path.
1074 const size_t path_len =
1075 uri_path.c_str() + uri_path.size() - splitter.field();
1076 unresolved_path->reserve(path_len);
1077 unresolved_path->clear();
1078 for (butil::StringSplitter slash_sp(
1079 splitter.field(), splitter.field() + path_len, '/');
1080 slash_sp != NULL; ++slash_sp) {
1081 if (!unresolved_path->empty()) {
1082 unresolved_path->push_back('/');
1083 }
1084 unresolved_path->append(slash_sp.field(), slash_sp.length());
1085 }
1086}
1087
1088inline const Server::MethodProperty*
1089FindMethodPropertyByURIImpl(const std::string& uri_path, const Server* server,

Callers 1

Calls 9

fieldMethod · 0.80
clearMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
reserveMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45
appendMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected