mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
ServerConfig: replace return(1) to continue;
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
ServerConfig::ServerConfig()
|
ServerConfig::ServerConfig()
|
||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
_clientBodySize = 0;
|
_clientBodySize = -1;
|
||||||
_port = 0;
|
_port = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ ServerConfig::ServerConfig(TOMLMap *map)
|
|||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
server = map;
|
server = map;
|
||||||
_clientBodySize = 0;
|
_clientBodySize = -1;
|
||||||
_port = 0;
|
_port = 0;
|
||||||
|
|
||||||
fillFields();
|
fillFields();
|
||||||
@@ -143,7 +143,7 @@ void ServerConfig::resetLocation(location *tmp)
|
|||||||
{
|
{
|
||||||
tmp->autoindex = false;
|
tmp->autoindex = false;
|
||||||
tmp->uploadAccept = false;
|
tmp->uploadAccept = false;
|
||||||
tmp->clientBodySize = 0;
|
tmp->clientBodySize = -1;
|
||||||
}
|
}
|
||||||
int ServerConfig::putLocation(toml_node *node)
|
int ServerConfig::putLocation(toml_node *node)
|
||||||
{
|
{
|
||||||
@@ -165,75 +165,75 @@ int ServerConfig::putLocation(toml_node *node)
|
|||||||
it1 = map->begin();
|
it1 = map->begin();
|
||||||
tmp = new location;
|
tmp = new location;
|
||||||
resetLocation(tmp);
|
resetLocation(tmp);
|
||||||
while (it1 != map->end())
|
for (;it1 != map->end(); it1++)
|
||||||
{
|
{
|
||||||
if (it1->first == "location")
|
if (it1->first == "location")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::STRING)
|
if (it1->second->get_type() != toml_node::STRING)
|
||||||
return (1);
|
continue;
|
||||||
tmp->location = *it1->second->getString();
|
tmp->location = *it1->second->getString();
|
||||||
}
|
}
|
||||||
else if (it1->first == "root")
|
else if (it1->first == "root")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::STRING)
|
if (it1->second->get_type() != toml_node::STRING)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->root = *it1->second->getString();
|
tmp->root = *it1->second->getString();
|
||||||
}
|
}
|
||||||
else if (it1->first == "autoindex")
|
else if (it1->first == "autoindex")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::BOOL)
|
if (it1->second->get_type() != toml_node::BOOL)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->autoindex = it1->second->getBool();
|
tmp->autoindex = it1->second->getBool();
|
||||||
}
|
}
|
||||||
else if (it1->first == "upload_accept")
|
else if (it1->first == "upload_accept")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::BOOL)
|
if (it1->second->get_type() != toml_node::BOOL)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->uploadAccept = it1->second->getBool();
|
tmp->uploadAccept = it1->second->getBool();
|
||||||
}
|
}
|
||||||
else if (it1->first == "upload_dir")
|
else if (it1->first == "upload_dir")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::STRING)
|
if (it1->second->get_type() != toml_node::STRING)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->uploadDir = *it1->second->getString();
|
tmp->uploadDir = *it1->second->getString();
|
||||||
}
|
}
|
||||||
else if (it1->first == "cgi_pass")
|
else if (it1->first == "cgi_pass")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::STRING)
|
if (it1->second->get_type() != toml_node::STRING)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->cgi_pass = *it1->second->getString();
|
tmp->cgi_pass = *it1->second->getString();
|
||||||
}
|
}
|
||||||
else if (it1->first == "body_size_limit")
|
else if (it1->first == "body_size_limit")
|
||||||
{
|
{
|
||||||
|
DBOUT << "BodySize in locaton" << ENDL;
|
||||||
if (node->get_type() != toml_node::NUM)
|
if (node->get_type() != toml_node::NUM)
|
||||||
return (1);
|
continue;
|
||||||
tmp->clientBodySize = it1->second->getNum();
|
tmp->clientBodySize = it1->second->getNum();
|
||||||
}
|
}
|
||||||
else if (it1->first == "directory_file")
|
else if (it1->first == "directory_file")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::STRING)
|
if (it1->second->get_type() != toml_node::STRING)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->directoryFile = *it1->second->getString();
|
tmp->directoryFile = *it1->second->getString();
|
||||||
}
|
}
|
||||||
else if (it1->first == "methods")
|
else if (it1->first == "methods")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::ARRAY)
|
if (it1->second->get_type() != toml_node::ARRAY)
|
||||||
return (1);
|
continue ;
|
||||||
Array = *it1->second->getArray();
|
Array = *it1->second->getArray();
|
||||||
it2 = Array.begin();
|
it2 = Array.begin();
|
||||||
while (it2 != Array.end())
|
while (it2 != Array.end())
|
||||||
{
|
{
|
||||||
if ((*it2)->get_type() != toml_node::STRING)
|
if ((*it2)->get_type() != toml_node::STRING)
|
||||||
return (1);
|
continue ;
|
||||||
tmp->methods.push_back(*((*it2)->getString()));
|
tmp->methods.push_back(*((*it2)->getString()));
|
||||||
++it2;
|
++it2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (it1->first == "redirect")
|
else if (it1->first == "redirect")
|
||||||
{
|
{
|
||||||
if (it1->second->get_type() != toml_node::ARRAY)
|
if (it1->second->get_type() != toml_node::ARRAY)
|
||||||
return (1);
|
continue ;
|
||||||
Array = *it1->second->getArray();
|
Array = *it1->second->getArray();
|
||||||
it2 = Array.begin();
|
it2 = Array.begin();
|
||||||
str = *(*it2)->getString();
|
str = *(*it2)->getString();
|
||||||
@@ -242,7 +242,6 @@ int ServerConfig::putLocation(toml_node *node)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::cout << RED << it1->first << ZERO_C << std::endl;
|
std::cout << RED << it1->first << ZERO_C << std::endl;
|
||||||
it1++;
|
|
||||||
}
|
}
|
||||||
_locations.push_back(tmp);
|
_locations.push_back(tmp);
|
||||||
it++;
|
it++;
|
||||||
|
|||||||
Reference in New Issue
Block a user