some cleanup of config stuff

This commit is contained in:
Me
2022-08-07 22:54:58 +02:00
parent 94852babc6
commit cf69168a84
2 changed files with 18 additions and 20 deletions

View File

@@ -17,21 +17,18 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
if (it->root == "")
throw std::invalid_argument("Config file needs a root");
if (it->client_body_limit == 0)
it->client_body_limit = 5000; // what is the recomended size?
// index is mandatory in Server
if (it->index.empty())
throw std::invalid_argument("Config file needs an Index");
if (it->client_body_limit == 0)
it->client_body_limit = 5000; // what is the recomended size?
// if error_pages is left empty, we'll use the defaults which
// i believe are set elsewhere...
// actually do this at the end, once we know if there aren't any locations
// with path /
if (!_find_root_path_location(it->locations))
{
LocationConfig tmp;
@@ -55,10 +52,8 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
if (it_l->allow_methods == UNKNOWN)
it_l->allow_methods = ANY_METHODS;
// fill out index from Server?
// or do a bunch of checks on what is in there...
if (it_l->index.empty())
it_l->index = it->index; // right?
it_l->index = it->index;
// same for redirect status i think
@@ -74,11 +69,6 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
++it_l;
}
// std::cout << "made it to sorting...\n";
// std::sort(it->locations.begin(), it->locations.end(), compareLocationConfigs);
std::sort(it->locations.begin(), it->locations.end());
std::reverse(it->locations.begin(), it->locations.end());