add: cgi_pass in config file

This commit is contained in:
Talyx
2022-02-09 17:15:46 +03:00
parent 9f3076bc53
commit f1b2b04119
3 changed files with 9 additions and 1 deletions

View File

@@ -176,7 +176,7 @@ std::string Client::generateRespons(std::vector<ServerConfig *> &configs)
_config = Config::getConfig(configs, _request, connected_to);
tmp = Config::getLocation(_config->getLocations(), _request.getURI());
_response.setData(_request, _config, tmp);
_response.generate2();
_response.generate2(connected_to);
_headerToSend = _response.getHeader();
_bodyToSend = _response.getBody();
_toSend = _headerToSend + _bodyToSend;

View File

@@ -184,6 +184,12 @@ int ServerConfig::putLocation(toml_node *node)
return (1);
tmp->uploadDir = *it1->second->getString();
}
else if (it1->first == "cgi_pass")
{
if (it1->second->get_type() != toml_node::STRING)
return (1);
tmp->cgi_pass = *it1->second->getString();
}
else if (it1->first == "directory_file")
{
if (it1->second->get_type() != toml_node::STRING)
@@ -281,6 +287,7 @@ void ServerConfig::printFields(void)
std::cout << YELLOW << "uploadDir " << BLUE << (*it)->uploadDir <<std::endl;
std::cout << YELLOW << "autoindex " << BLUE << (*it)->autoindex <<std::endl;
std::cout << YELLOW << "uploadAccept " << BLUE << (*it)->uploadAccept <<std::endl;
std::cout << YELLOW << "cgi_pass " << BLUE << (*it)->cgi_pass <<std::endl;
std::cout << YELLOW << "methods " << std::endl;
it2 = (*it)->methods.begin();
while (it2 != (*it)->methods.end())

View File

@@ -14,6 +14,7 @@ struct location
bool uploadAccept;
std::vector<std::string> methods;
std::map<int, std::string> redirect;
std::string cgi_pass;
};
struct serverListen