| 106 | } |
| 107 | |
| 108 | static std::string EndpointHost(const std::string& endpoint) { |
| 109 | std::string ep = endpoint; |
| 110 | if (!ep.empty() && ep[0] == '[') { |
| 111 | const size_t right = ep.find(']'); |
| 112 | if (right != std::string::npos) { |
| 113 | return ep.substr(1, right - 1); |
| 114 | } |
| 115 | return ep; |
| 116 | } |
| 117 | const size_t p = ep.rfind(':'); |
| 118 | if (p == std::string::npos) { |
| 119 | return ep; |
| 120 | } |
| 121 | return ep.substr(0, p); |
| 122 | } |
| 123 | |
| 124 | static bool EncodeReply(const RedisReply& reply, butil::IOBuf* out) { |
| 125 | butil::IOBufAppender appender; |
no test coverage detected