mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 05:17:59 +03:00
fix: leak in Response class
This commit is contained in:
@@ -13,7 +13,7 @@ Request::Request()
|
||||
_received = 0;
|
||||
_headerSize = 0;
|
||||
_lifeTime = 5;
|
||||
_body = new std::string;
|
||||
_body = NULL;
|
||||
}
|
||||
|
||||
Request::Request(char *str)
|
||||
@@ -28,12 +28,17 @@ Request::Request(char *str)
|
||||
_contentLength = 0;
|
||||
_headerSize = 0;
|
||||
_lifeTime = 5;
|
||||
_body = new std::string;
|
||||
_body = NULL;
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------Get/Set---------------------------------------
|
||||
|
||||
void Request::freeData(void)
|
||||
{
|
||||
delete _body;
|
||||
}
|
||||
|
||||
std::string &Request::getURI(void)
|
||||
{
|
||||
return (_URI);
|
||||
@@ -226,11 +231,13 @@ void Request::splitData(std::string &data)
|
||||
if ((_contentLength == 0 && !_chunked) || (_method == "GET"
|
||||
|| _method == "DELETE" || _method == "HEAD"))
|
||||
_body_ok = true;
|
||||
else
|
||||
_body = new std::string;
|
||||
}
|
||||
}
|
||||
if (badCode(_ret))
|
||||
return ;
|
||||
else if (_chunked)
|
||||
else if (_chunked && !_body_ok)
|
||||
{
|
||||
_body->insert(_body->end(), str.begin(), str.end());
|
||||
if (checkEnd(*_body, "0\r\n\r\n") == 0)
|
||||
|
||||
Reference in New Issue
Block a user