autoindex in progress but need to check stuff on master branch

This commit is contained in:
Me
2022-08-07 20:37:53 +02:00
parent 4870b2c05d
commit f777441edf
9 changed files with 90 additions and 69 deletions

View File

@@ -5,11 +5,6 @@
void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
{
// make certain servers default
// fill out empty settings
// if special settings are empty throw
std::vector<ServerConfig>::iterator it = servers->begin();
while (it != servers->end())
@@ -25,12 +20,6 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
if (it->client_body_limit == 0)
it->client_body_limit = 5000; // what is the recomended size?
// autoindex is False by Default
// if Allow methodes not specified we set to ALL
if (it->allow_methods == UNKNOWN) // in this case that means nothing...
it->allow_methods = ANY_METHODS;
// would prefer ALL_METHODS
if (it->index.empty())
throw std::invalid_argument("Config file needs an Index");
@@ -48,10 +37,10 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
LocationConfig tmp;
tmp.path = "/";
tmp.client_body_limit = 5000; // figur out correct amount
tmp.root = it->root;
tmp.index = it->index;
tmp.allow_methods = it->allow_methods;
tmp.allow_methods = ANY_METHODS;
tmp.autoindex = false;
tmp.redirect_status = 0;
it->locations.push_back(tmp);
}
@@ -60,15 +49,11 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
while (it_l != it->locations.end())
{
if (it_l->client_body_limit == 0)
it_l->client_body_limit = 5000; // what is the recomended size?
if (it_l->root == "")
it_l->root = it->root;
// if Allow methodes not specified we set to Server methods
if (it_l->allow_methods == UNKNOWN) // in this case that means nothing...
it_l->allow_methods = it->allow_methods;
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...
@@ -108,7 +93,7 @@ bool ConfigParser::_find_root_path_location(std::vector<LocationConfig> location
{
if (it->path.compare("/") == 0)
{
std::cout << "in compare: " << it->path << " -- ";
// std::cout << "in compare: " << it->path << " -- ";
return true;
}
++it;