mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 21:38:00 +03:00
fix: leak in Response class
This commit is contained in:
@@ -99,7 +99,9 @@ std::string CgiHandle::executeCgi()
|
||||
FILE *fOt = tmpfile();
|
||||
long fdin = fileno(fIn);
|
||||
long fdOut = fileno(fOt);
|
||||
write(fdin, _request.getBody()->data(), _request.getBody()->size());
|
||||
if (_request.getBody() != NULL)
|
||||
write(fdin, _request.getBody()->data(), _request.getBody()->size());
|
||||
|
||||
lseek(fdin, 0, SEEK_SET);
|
||||
pid = fork();
|
||||
if (pid == -1)
|
||||
@@ -151,7 +153,7 @@ void CgiHandle::initEnvVariables()
|
||||
_variable["AUTH TYPE"] = it->second;
|
||||
else
|
||||
_variable["AUTH TYPE"] = "";
|
||||
_variable["CONTENT_LENGTH"] = toString(_request.getBody()->size());
|
||||
_variable["CONTENT_LENGTH"] = (_request.getBody() == NULL) ? "0" : toString(_request.getBody()->size());
|
||||
it = _request.getClientFields().find("content-type");
|
||||
_variable["CONTENT_TYPE"] = "";
|
||||
_variable["GATEWAY_INTERFACE"] = std::string("CGI/1.1");
|
||||
|
||||
Reference in New Issue
Block a user