Normalize the sub string of `uri_path' covered by `splitter' and put it into `unresolved_path'
| 1061 | // Normalize the sub string of `uri_path' covered by `splitter' and |
| 1062 | // put it into `unresolved_path' |
| 1063 | static 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 | |
| 1088 | inline const Server::MethodProperty* |
| 1089 | FindMethodPropertyByURIImpl(const std::string& uri_path, const Server* server, |