CGI discussion and a little bit of work done

This commit is contained in:
LuckyLaszlo
2022-08-12 18:08:39 +02:00
parent cade79c37f
commit b44acafefe
9 changed files with 61 additions and 59 deletions

View File

@@ -1,14 +1,21 @@
#include "Webserv.hpp"
bool Webserv::_is_cgi(Client *client)
// TODO HUGO : go ameliorer la recherche comme on a dit.
size_t Webserv::_cgi_pos(Client *client, std::string &path)
{
// TODO see how it works with config
if (client->fill_script_path("/cgi-bin/php-cgi"))
size_t pos = NPOS;
std::vector<std::string>::const_iterator it;
it = client->assigned_location->cgi_ext.begin();
while (it != client->assigned_location->cgi_ext.end())
{
pos = std::min(path.find(*it) + it->size(), pos);
++it;
}
if (pos == NPOS)
return false;
else
return true;
if (client->fill_script_path("/cgi-bin/cgi_cpp.cgi"))
return true;
return false;
}
std::string Webserv::_exec_cgi(Client *client)