Enhancements

Fix not processing quotes in ws-headers in Surge VMess configurations.
Fix when default_url is set and insert_url is not set in YAML configuration and access /sub without url argument, the nodes in default_url will be added twice.
Add /version interface to compatible with some front-end.
This commit is contained in:
Tindy X committed 2020-03-11 23:54:08 +08:00
1 parent 550670006d
commit 5594070657
6 files changed
+39 -16

No files matched your search

+13 -3
View File
@@ -438,14 +438,14 @@ std::string getSystemProxy()
#endif // _WIN32
}
std::string trim(const std::string& str)
std::string trim_of(const std::string& str, char target)
{
std::string::size_type pos = str.find_first_not_of(' ');
std::string::size_type pos = str.find_first_not_of(target);
if (pos == std::string::npos)
{
return str;
}
std::string::size_type pos2 = str.find_last_not_of(' ');
std::string::size_type pos2 = str.find_last_not_of(target);
if (pos2 != std::string::npos)
{
return str.substr(pos, pos2 - pos + 1);
@@ -453,6 +453,16 @@ std::string trim(const std::string& str)
return str.substr(pos);
}
std::string trim(const std::string& str)
{
return trim_of(str, ' ');
}
std::string trim_quote(const std::string &str)
{
return trim_of(str, '\"');
}
std::string getUrlArg(const std::string &url, const std::string &request)
{
//std::smatch result;