started non hardcoded cgi call

This commit is contained in:
Me
2022-08-12 16:20:50 +02:00
parent 52824f30bd
commit cade79c37f
4 changed files with 24 additions and 17 deletions

View File

@@ -71,6 +71,16 @@ void Webserv::_construct_response(Client *client)
{
/* Switch between normal behavior or CGI here ?
maybe better than in _get(), _post(), ...*/
std::string path = _replace_url_root(client, client->get_rq_abs_path());
std::string script_output;
if (_is_cgi(path))
{
script_output = _exec_cgi(client);
_check_script_output(client, script_output);
client->response += script_output;
return;
}
_process_method(client);
}