Implement mxs::[l|r]trim(std::string&);

Also remove the non-used implementation in httprequest.cc
This commit is contained in:
Johan Wikman
2018-05-18 16:11:41 +03:00
parent 2e8c19f6be
commit 0f8bf9b6e2
2 changed files with 35 additions and 34 deletions

View File

@ -27,40 +27,6 @@ using std::deque;
const std::string HttpRequest::HTTP_PREFIX = "http://";
const std::string HttpRequest::HTTPS_PREFIX = "https://";
/** TODO: Move this to a C++ string utility header */
namespace maxscale
{
static inline string& trim(string& str)
{
if (str.length())
{
if (isspace(*str.begin()))
{
string::iterator it = str.begin();
while (it != str.end() && isspace(*it))
{
it++;
}
str.erase(str.begin(), it);
}
if (isspace(*str.rbegin()))
{
string::reverse_iterator it = str.rbegin();
while (it != str.rend() && isspace(*it))
{
it++;
}
str.erase(it.base(), str.end());
}
}
return str;
}
}
static void process_uri(string& uri, std::deque<string>& uri_parts)
{
/** Clean up trailing slashes in requested resource */