NPOS macro

This commit is contained in:
LuckyLaszlo
2022-08-12 18:16:49 +02:00
parent b44acafefe
commit c7bbf29a1b
9 changed files with 43 additions and 43 deletions

View File

@@ -352,7 +352,7 @@ void Client::_parse_request_target( std::string target )
size_t pos;
pos = target.find("?");
if (pos != std::string::npos)
if (pos != NPOS)
_request.query = target.substr(pos + 1);
else
_request.query = "";
@@ -368,11 +368,11 @@ void Client::_parse_request_fields()
headers = raw_request;
// delete first line
pos = headers.find(CRLF);
if (pos != std::string::npos)
if (pos != NPOS)
headers.erase(0, pos + std::string(CRLF).size());
// delete body part
pos = headers.find(CRLF CRLF);
if (pos != std::string::npos)
if (pos != NPOS)
headers.erase(pos);
else {
std::cerr << "err _parse_request_fields(): request header doesn't end with empty line\n";
@@ -396,7 +396,7 @@ void Client::_parse_port_hostname(std::string host)
pos = host.find(':');
// port :
if (pos == std::string::npos)
if (pos == NPOS)
_request.port = "4040"; // TODO: make equal to default port in config
else
_request.port = host.substr(pos);