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

@@ -1,30 +1,21 @@
#include "Webserv.hpp"
// const?
void Webserv::_get(Client *client)
std::string Webserv::_replace_url_root(Client *client, std::string path)
{
std::string path = client->get_rq_abs_path();
std::cerr << "path before = " << path << "\n"; // DEBUG
std::cerr << "path before = " << client_path << "\n"; // DEBUG
if (client->assigned_location->path == "/")
path.insert(0, client->assigned_location->root);
else
path.replace(0, client->assigned_location->path.size(), client->assigned_location->root);
std::cerr << "path after = " << path << "\n"; // DEBUG
return path;
}
// const?
void Webserv::_get(Client *client)
{
// TMP HUGO ( We move this in process_switch() )
//
std::string script_output;
if (_is_cgi(client))
{
script_output = _exec_cgi(client);
_check_script_output(client, script_output);
client->response += script_output;
return;
}
//
// END TMP HUGO
// Index/Autoindex block
if (eval_file_type(path) == IS_DIR)