Fix URL encoding issues; remove request shortcuts.

This commit is contained in:
Chunting Gu
2019-08-23 14:51:41 +08:00
parent 9b31ac855a
commit 1a21989b2e
16 changed files with 372 additions and 365 deletions
+8 -6
View File
@@ -35,18 +35,20 @@ std::string GetTimestamp() {
return ss.str();
}
bool SplitKV(const std::string& str, char delimiter,
std::string* part1, std::string* part2) {
bool SplitKV(const std::string& str, char delimiter, std::string* key,
std::string* value, bool trim) {
std::size_t pos = str.find(delimiter);
if (pos == std::string::npos) {
return false;
}
*part1 = str.substr(0, pos);
*part2 = str.substr(pos + 1);
*key = str.substr(0, pos);
*value = str.substr(pos + 1);
boost::trim(*part1);
boost::trim(*part2);
if (trim) {
boost::trim(*key);
boost::trim(*value);
}
return true;
}