Files
42_INT_12_webserv/srcs/config/ServerConfig.hpp
LuckyLaszlo 400efbe720 Wip chunked decoding
+ Need to test normal body parsing
+ path_is_valid() renamed eval_file_type()
+ replaced atoi with strtol/strtoul
2022-08-12 05:50:00 +02:00

67 lines
1.7 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
// a class that's all public? just so we have options?
class ServerConfig
{
public:
// do i need some canonic stuff?
std::vector<std::string> server_name;
// we could shove default in here if we wanted to...
std::string host;
std::string port; // port needs to be something else... not quite an int
std::string root; // ./www/ or www work www/ and www work
// i do remove trailing / tho
size_t client_body_limit; // set to default max if none set
std::vector<std::string> index;
std::map<int, std::string> error_pages;
std::vector<LocationConfig> locations;
void print_all()
{
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>::iterator it = error_pages.begin(); \
it != error_pages.end(); it++)
std::cout << it->first << "--" << it->second << " ";
// for (size_t i = 0; i < error_pages.size(); i++)
// std::cout << error_pages->first << "--" << error_pages->second << " ";
// std::cout << "skiping Locations for now...\n";
for (std::vector<LocationConfig>::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