wip parsing first line http message with new utils functions

This commit is contained in:
hugogogo
2022-08-10 20:27:48 +02:00
parent 9a379c835d
commit 11f71ea74f
5 changed files with 9 additions and 33 deletions

View File

@@ -22,18 +22,19 @@ std::vector<std::string> split(std::string input, char delimiter)
}
std::vector<std::string>
split_trim(std::string input, std::string delim = "\n", char ctrim = '')
split_trim(std::string input, std::string delim = "\n", char ctrim = '\0')
{
std::vector<std::string> split_str;
std::string tmp;
size_t start = 0;
size_t end;
std::vector<std::string> split_str;
std::string tmp;
int start = 0;
int end;
end = input.find(delim);
while (end != -1)
{
tmp = input.substr(start, end - start);
tmp = trim(tmp, ctrim);
if (ctrim != '\0')
tmp = trim(tmp, ctrim);
if (tmp.size() != 0)
split_str.push_back( tmp );
start = end + delim.size();