wip atoi
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
# include <sstream>
|
||||
#include <string.h>
|
||||
|
||||
static int eval_is_negative(int *n)
|
||||
@@ -28,6 +29,14 @@ static int eval_digit_nbr(int n)
|
||||
|
||||
char *ft_itoa(int n)
|
||||
{
|
||||
|
||||
// std::stringstream strs;
|
||||
// std::string s;
|
||||
//
|
||||
// strs << n;
|
||||
// s = strs.str();
|
||||
// return ((char*)(s.c_str()));
|
||||
|
||||
int i;
|
||||
char *str;
|
||||
int is_negative;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
|
||||
|
||||
#include "Webserv.hpp"
|
||||
|
||||
|
||||
|
||||
std::vector<std::string> split(std::string input, char delimiter)
|
||||
{
|
||||
std::vector<std::string> answer;
|
||||
@@ -16,4 +13,3 @@ std::vector<std::string> split(std::string input, char delimiter)
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,18 @@ void Webserv::init_virtual_servers(std::vector<ServerConfig>* servers)
|
||||
std::perror("err socket()");
|
||||
throw std::runtime_error("Socket init");
|
||||
}
|
||||
// HUGO ADD
|
||||
//
|
||||
// allow socket descriptor to be reuseable
|
||||
// I just copied it from https://www.ibm.com/docs/en/i/7.2?topic=designs-example-nonblocking-io-select
|
||||
int on = 1;
|
||||
if (setsockopt(ret, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
|
||||
{
|
||||
::perror("err setsockopt()");
|
||||
throw std::runtime_error("Socket init");
|
||||
}
|
||||
//
|
||||
// HUGO ADD END
|
||||
_listen_sockets.push_back(ret);
|
||||
|
||||
_bind(_listen_sockets.back(), std::atoi(it->port.data()), it->host);
|
||||
|
||||
Reference in New Issue
Block a user