NPOS macro
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user