autoindex is working, a few things to iron out be we well on our way
This commit is contained in:
@@ -147,8 +147,8 @@ LocationConfig ConfigParser::_parse_location(size_t *start)
|
||||
ret.allow_methods = 0;
|
||||
|
||||
ret.path = _get_first_word(&curr);
|
||||
if (ret.path[0] != '/')
|
||||
throw std::invalid_argument("Location path require a leading /");
|
||||
// if (ret.path[0] != '/')
|
||||
// throw std::invalid_argument("Location path require a leading /");
|
||||
// in theory now curr should be right after the "path"
|
||||
|
||||
curr = _content.find_first_not_of(" \t\n", curr);
|
||||
@@ -232,14 +232,15 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
|
||||
}
|
||||
else if (key == "root" && size == 1 && server->root == "")
|
||||
{
|
||||
if (tmp_val[0][0] != '/')
|
||||
throw std::invalid_argument("Root requires leading /");
|
||||
// if (tmp_val[0][0] != '/')
|
||||
// throw std::invalid_argument("Root requires leading /");
|
||||
|
||||
// std::cout << "root: " << tmp_val[0] << '\n';
|
||||
if (path_is_valid(tmp_val[0]) == 1)
|
||||
//might not even do these checks here...
|
||||
// if (path_is_valid(tmp_val[0]) == 1)
|
||||
server->root = tmp_val[0];
|
||||
else
|
||||
throw std::invalid_argument("Root dir invalid 1");
|
||||
// else
|
||||
// throw std::invalid_argument("Root dir invalid 1");
|
||||
}
|
||||
else if (key == "client_body_limit" && size == 1 \
|
||||
&& server->client_body_limit == 0)
|
||||
@@ -303,17 +304,18 @@ void ConfigParser::_set_location_values(LocationConfig *location, \
|
||||
else if (key == "root" && size == 1 && location->root == "")
|
||||
{
|
||||
// std::cout << "location root: " << tmp_val[0] << '\n';
|
||||
if (tmp_val[0][0] != '/')
|
||||
throw std::invalid_argument("Root requires leading /");
|
||||
// if (tmp_val[0][0] != '/')
|
||||
// throw std::invalid_argument("Root requires leading /");
|
||||
|
||||
if (path_is_valid(tmp_val[0]) == 1)
|
||||
// if (path_is_valid(tmp_val[0]) == 1)
|
||||
location->root = tmp_val[0];
|
||||
else
|
||||
throw std::invalid_argument("Root dir invalid");
|
||||
// else
|
||||
// throw std::invalid_argument("Root dir invalid");
|
||||
}
|
||||
else if (key == "autoindex" && size == 1)
|
||||
{
|
||||
location->autoindex = (tmp_val[0] == "on" ? true : false);
|
||||
std::cout << "in parser " << location->path << " autoindex: " << location->autoindex << '\n';
|
||||
}
|
||||
else if (key == "index")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user