1. Choose the port and host of each ’server’

Syntax: listen ip:port

E.g. listen 127.0.0.1:8080;

This will be checked while starting a server. It will be stored as a string in ServerConfig attribute.

2. Setup the server_names or not.

Syntax: server_name <name>

E.g. server_name webserv.com;

It will be stored as a string in ServerConfig attribute. It’s not necessary to set it.

3. The first server for a host:port will be the default for this host:port (that means

it will answer to all the requests that don’t belong to an other server).

If the server_name attribute from http request is not set, then it goes to the first server with the same listening port. The server will be stored in a vector, if the host:port is the same, then only 1 socket will be created, so this part just follows the ServerConfig to find the corresponding response.

4. Setup default error pages.

Syntax: error_page <error_code> </path/to/the/page>;

E.g. error_page 403 /web/error_pages/403.html;

It will be stored as a map in ServerConfig attribute, no duplicated status codes allowed

5. Limit client body size.

Syntax: client_max_body_size <number><unit(M,K)>;

E.g. client_max_body_size 2M;

It will be stored as an ‘int’ in LocationConfig attribute. The total size can’t be larger than MAX_INT

6. Setup routes with one or multiple of the following rules/configuration (routes wont

be using regexp)