58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
|
|
#ifndef SERVERCONFIG_HPP
|
|
# define SERVERCONFIG_HPP
|
|
|
|
# include "utils.hpp"
|
|
# include "LocationConfig.hpp"
|
|
|
|
# include <map>
|
|
# include <vector>
|
|
# include <string> // string
|
|
# include <iostream> // cout, cin
|
|
|
|
struct ServerConfig
|
|
{
|
|
std::vector<std::string> server_name;
|
|
|
|
std::string host;
|
|
std::string port;
|
|
|
|
std::string root;
|
|
|
|
size_t client_body_limit;
|
|
|
|
std::vector<std::string> index;
|
|
std::map<int, std::string> error_pages;
|
|
|
|
std::vector<LocationConfig> locations;
|
|
|
|
|
|
void print_all() const
|
|
{
|
|
std::cout << "PRINTING A FULL SERVER CONFIG\n\n";
|
|
|
|
for (size_t i = 0; i < server_name.size(); i++)
|
|
std::cout << server_name[i] << " ";
|
|
std::cout << "root: " << root << '\n';
|
|
std::cout << "index: ";
|
|
for (size_t i = 0; i < index.size(); i++)
|
|
std::cout << index[i] << " ";
|
|
std::cout << "\nerror_pages: ";
|
|
for(std::map<int, std::string>::const_iterator it = error_pages.begin(); \
|
|
it != error_pages.end(); it++)
|
|
std::cout << it->first << "--" << it->second << " ";
|
|
|
|
for (std::vector<LocationConfig>::const_iterator it = locations.begin(); it < locations.end(); it++)
|
|
it->print_all();
|
|
|
|
std::cout << "client_body_limit: " << client_body_limit << '\n';
|
|
std::cout << "host: " << host << '\n';
|
|
std::cout << "port: " << port << '\n';
|
|
|
|
std::cout << "\n----------\n";
|
|
}
|
|
};
|
|
|
|
#endif
|
|
|