fixed pbm in extract_line : delete the line and the newline sequence character

+ fixed pbm n _cgi_pos : last return is npos, not pos
This commit is contained in:
hugogogo
2022-08-13 12:39:05 +02:00
parent f17bc9fa58
commit defb2ada61
4 changed files with 14 additions and 16 deletions

View File

@@ -198,8 +198,8 @@ std::string str_tolower(std::string str)
}
// identify a line in a string, by delim (ex. '\n')
// delete this line from the string
// and return the deleted line
// delete this line from the string (and the following nl sequence characters)
// and return the deleted line (without the followinf nl sequence characters)
std::string
extract_line(std::string & str, size_t pos, std::string delim)
{
@@ -220,7 +220,7 @@ std::string
len = end - begin;
del_str = str.substr(begin, len);
str.erase(begin, len);
str.erase(begin, len + delim.size());
return del_str;
}