is_cgi function is back and is working

+ in utils added function eval_file_mode(), it returns http errors codes about file
This commit is contained in:
Hugo LAMY
2022-08-14 01:05:20 +02:00
parent 285f2d049f
commit db4c7468cc
9 changed files with 100 additions and 35 deletions

View File

@@ -67,17 +67,15 @@ void Webserv::_append_base_headers(Client *client)
client->response.append("Connection: keep-alive" CRLF);
}
// TODO HUGO : wip
void Webserv::_construct_response(Client *client)
{
std::string path;
std::string script_output;
path = _replace_url_root(client, client->get_rq_abs_path());
size_t pos = _cgi_pos(client, path); /*DEBUG*/ std::cout << "pos:" << pos << "\n&path[pos]:" << &path[pos] << "\n" << B_YELLOW << "fin debug _cgi_pos()\n\n" << RESET;
if (pos != NPOS)
if (_is_cgi(client, path))
{
client->fill_script_path(path, pos);
script_output = _exec_cgi(client);
_check_script_output(client, script_output);
client->response += script_output;