added timeout response (status 408)

+ added EPOLLERR and EPOLLHUP handling
+ fix root substitution for default "/" location (temp or permanent ?)
+ tested siege a little, seems good
This commit is contained in:
LuckyLaszlo
2022-08-11 07:12:13 +02:00
parent 08f6929db9
commit ab0bc2c4c0
13 changed files with 139 additions and 38 deletions

View File

@@ -49,7 +49,7 @@ void Webserv::init_virtual_servers(std::vector<ServerConfig>* servers)
// HUGO ADD END
_bind(new_socket.fd, std::atoi(it->port.c_str()), it->host);
_listen(new_socket.fd, 512); // 512 arbitrary
_listen(new_socket.fd, 42); // 42 arbitrary
if (_epoll_update(new_socket.fd, EPOLLIN, EPOLL_CTL_ADD) == -1)
throw std::runtime_error("Socket init");
@@ -89,7 +89,7 @@ void Webserv::_listen(int socket_fd, unsigned int max_connections)
void Webserv::_init_http_status_map()
{
/* "map.insert()" over "map.operator[]" :
/* "map.insert()" more appropriate than "map.operator[]" :
** http://www.uml.org.cn/c%2B%2B/pdf/EffectiveSTL.pdf#page=93
*/
typedef std::map<int, std::string>::value_type status_pair;
@@ -110,6 +110,7 @@ void Webserv::_init_http_status_map()
_http_status.insert(status_pair(403, S403));
_http_status.insert(status_pair(404, S404));
_http_status.insert(status_pair(405, S405));
_http_status.insert(status_pair(408, S408));
_http_status.insert(status_pair(413, S413));
_http_status.insert(status_pair(500, S500));