| 152 | } |
| 153 | |
| 154 | void PercentDecode(const std::string& str, std::string* str_out) { |
| 155 | std::ostringstream unescaped; |
| 156 | for (std::string::const_iterator it = str.begin(); |
| 157 | it != str.end(); ++it) { |
| 158 | const std::string::value_type& c = *it; |
| 159 | if (c == '%' && it + 2 < str.end()) { |
| 160 | int i1 = hex_to_int(*++it); |
| 161 | int i2 = hex_to_int(*++it); |
| 162 | unescaped << (char)(i1 * 16 + i2); |
| 163 | } else { |
| 164 | unescaped << c; |
| 165 | } |
| 166 | } |
| 167 | if (str_out) { |
| 168 | *str_out = unescaped.str(); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | int64_t ConvertGrpcTimeoutToUS(const std::string* grpc_timeout) { |
| 173 | if (!grpc_timeout || grpc_timeout->empty()) { |