+ refactoring in response.cpp (functions split) + added Client::clear() + added replace_all_substr() in utils.cpp
58 lines
1.0 KiB
C++
58 lines
1.0 KiB
C++
|
|
#include "Webserv.hpp"
|
|
|
|
Webserv::Webserv()
|
|
{
|
|
std::cerr << "Server init\n";
|
|
|
|
_epfd = ::epoll_create1(0); // (EPOLL_CLOEXEC) for CGI fork ?
|
|
if (_epfd == -1)
|
|
{
|
|
std::perror("err epoll_create1()");
|
|
throw std::runtime_error("Epoll init");
|
|
}
|
|
|
|
_init_http_status_map();
|
|
|
|
std::signal(SIGPIPE, signal_handler);
|
|
std::signal(SIGINT, signal_handler);
|
|
}
|
|
|
|
/* Webserv::Webserv(Webserv const &src)
|
|
{
|
|
|
|
} */
|
|
|
|
// we'll come back to this
|
|
/*
|
|
Webserv::Webserv(std::vector<ServerConfig>* servers)
|
|
: _servers(servers)
|
|
{
|
|
// talk to luke about what all this does
|
|
// the Param Constructor might need to do dif stuff
|
|
std::cout << "Server init\n";
|
|
|
|
_epfd = ::epoll_create1(0); // (EPOLL_CLOEXEC) for CGI fork ?
|
|
if (_epfd == -1)
|
|
{
|
|
std::perror("err epoll_create1(): ");
|
|
throw std::runtime_error("Epoll init");
|
|
}
|
|
}
|
|
*/
|
|
|
|
|
|
Webserv::~Webserv()
|
|
{
|
|
//close(_socket_fd);
|
|
// TODO : CLOSE ALL _listen_sockets
|
|
close(_epfd);
|
|
_close_all_clients();
|
|
std::cerr << "Server destroyed\n";
|
|
}
|
|
|
|
/* Webserv & Webserv::operator=(Webserv const &rhs)
|
|
{
|
|
|
|
} */
|