Fixed big problem with CGI handling

+ remains somes minors problems
This commit is contained in:
lperrey
2022-08-17 01:11:20 +02:00
parent 4dc70373f8
commit ccc542f52b
9 changed files with 96 additions and 118 deletions

View File

@@ -40,39 +40,6 @@ void Webserv::_close_all_clients_fd()
}
}
// TODO : not sure for zombie cgi-proccess, need to verif
void Webserv::_close_cgi_pipe_rfd(int fd)
{
std::vector<cgi_pipe_rfd>::iterator it = _cgi_pipe_rfds.begin();
std::vector<cgi_pipe_rfd>::iterator it_end = _cgi_pipe_rfds.end();
while (it != it_end)
{
if (*it == fd)
{
std::cerr << "close cgi-fd " << fd << "\n";
if (::close(fd) == -1)
std::perror("err close()");
_cgi_pipe_rfds.erase(it);
break;
}
++it;
}
}
void Webserv::_close_all_cgi_pipe_rfd()
{
std::vector<cgi_pipe_rfd>::iterator it = _cgi_pipe_rfds.begin();
std::vector<cgi_pipe_rfd>::iterator it_end = _cgi_pipe_rfds.end();
while (it != it_end)
{
std::cerr << "close cgi-fd " << it->fd << "\n";
if (::close(it->fd) == -1)
std::perror("err close()");
++it;
}
_cgi_pipe_rfds.clear();
}
void Webserv::_close_all_listen_sockets()
{ // TODO : change like clients (clear in place of pop_back)
while (!_listen_sockets.empty())