mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
TOMLMap parser startv1
This commit is contained in:
@@ -33,7 +33,6 @@ void Server::readConfig(void)
|
|||||||
while (it != arr->end())
|
while (it != arr->end())
|
||||||
{
|
{
|
||||||
_configs.push_back(new ServerConfig(*it));
|
_configs.push_back(new ServerConfig(*it));
|
||||||
std::cout << "biba\n";
|
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,32 +88,34 @@ void ServerConfig::setRoot(TOMLMap * data)
|
|||||||
|
|
||||||
int ServerConfig::putBodySizeLimit(toml_node *node)
|
int ServerConfig::putBodySizeLimit(toml_node *node)
|
||||||
{
|
{
|
||||||
std::cout << TURGUOISE << node << ZERO_C << std::endl;
|
if (node->get_type() != toml_node::e_type::NUM)
|
||||||
|
return (1);
|
||||||
|
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
int ServerConfig::putErrorPage(toml_node *node)
|
int ServerConfig::putErrorPage(toml_node *node)
|
||||||
{
|
{
|
||||||
std::cout << TURGUOISE << node << ZERO_C << std::endl;
|
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
int ServerConfig::putHost(toml_node *node)
|
int ServerConfig::putHost(toml_node *node)
|
||||||
{
|
{
|
||||||
std::cout << TURGUOISE << node << ZERO_C << std::endl;
|
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
int ServerConfig::putName(toml_node *node)
|
int ServerConfig::putName(toml_node *node)
|
||||||
{
|
{
|
||||||
std::cout << TURGUOISE << node << ZERO_C << std::endl;
|
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
int ServerConfig::putPort(toml_node *node)
|
int ServerConfig::putPort(toml_node *node)
|
||||||
{
|
{
|
||||||
std::cout << TURGUOISE << node << ZERO_C << std::endl;
|
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
int ServerConfig::putLocation(toml_node *node)
|
int ServerConfig::putLocation(toml_node *node)
|
||||||
{
|
{
|
||||||
std::cout << TURGUOISE << node << ZERO_C << std::endl;
|
std::cout << TURGUOISE << *node->toString() << ZERO_C << std::endl;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +127,7 @@ int ServerConfig::identify(TOMLMap::iterator it)
|
|||||||
putErrorPage(it->second);
|
putErrorPage(it->second);
|
||||||
else if (it->first == "host")
|
else if (it->first == "host")
|
||||||
putHost(it->second);
|
putHost(it->second);
|
||||||
else if (it->first == "loacation")
|
else if (it->first == "location")
|
||||||
putLocation(it->second);
|
putLocation(it->second);
|
||||||
else if (it->first == "name")
|
else if (it->first == "name")
|
||||||
putName(it->second);
|
putName(it->second);
|
||||||
@@ -144,6 +146,7 @@ void ServerConfig::fillFields(void)
|
|||||||
block = server->begin();
|
block = server->begin();
|
||||||
while (block != server->end() && ret == 0)
|
while (block != server->end() && ret == 0)
|
||||||
{
|
{
|
||||||
|
std::cout << GREEN << block->first << ZERO_C << std::endl;
|
||||||
ret = identify(block);
|
ret = identify(block);
|
||||||
++block;
|
++block;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user