-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
60 lines (50 loc) · 1.48 KB
/
Copy pathmain.cpp
File metadata and controls
60 lines (50 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <stdio.h>
#include "./includes/Request.hpp"
#include "./includes/utils.hpp"
#include "./includes/Server.hpp"
#include "./includes/Webserv.hpp"
#include "./includes/Client.hpp"
#include "./includes/RoutesConf.hpp"
#include "./includes/Config.hpp"
int main(int argc, char **argv)
{
char *file_name = NULL;
if (argc == 1 || argc == 2)
{
Config obj;
if (argc == 2)
file_name = argv[1];
std::vector <ServerConf> hold;
if (obj.parse_file(argc, file_name) == -1)
return 1;
if (obj.braces != 0)
{
std::cerr << "Error braces\n";
return (1);
}
else
{
obj.fill_default_routes();
hold = obj.get_servers();
for (int x = 0; x <= obj.server_index; x++)
{
std::vector <size_t> port_vector = hold[x].get_port();
for(int j = 0; j <= hold[x].routes_ndx; j++)
{
if (!(hold[x].get_routes()).empty())
{
std::vector <std::string> methods = hold[x].server_get_method(j);
}
}
}
}
Webserv webserv(hold);
webserv.run_server();
}
return 0;
}