🏗️」 wip: Started fixing cgi but no clue what is happening

This commit is contained in:
2025-07-01 11:28:27 +02:00
parent 8e5f80b994
commit 36f4609a25
5 changed files with 31 additions and 20 deletions

View File

@ -6,7 +6,7 @@
/* By: gadelbes <gadelbes@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/24 13:46:34 by gadelbes #+# #+# */
/* Updated: 2025/06/24 18:02:34 by adjoly ### ########.fr */
/* Updated: 2025/07/01 11:26:11 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -52,6 +52,7 @@ Cgi::Cgi(http::Post *req, config::Route *conf)
pfd.events = in->event();
pfd.revents = 0;
pfd.fd = in->getId();
std::cout << pfd.fd << std::endl;
server::PfdManager::append(pfd, server::RES);
}
@ -64,7 +65,8 @@ void Cgi::_prep(void) {
if (pipe(_stdout_pipe) == -1)
throw std::runtime_error("stdout pipe failed for cgi D:");
_script_path = _conf->getRootDir() + _request->getTarget();
_fd = _stdout_pipe[STDIN_FILENO];
_fd = _stdout_pipe[PIPE_READ];
std::cout << "sus = " << _fd << std::endl;
_pfd_event = POLLIN;
if (access(_script_path.c_str(), X_OK))
throw std::runtime_error(

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/27 18:22:48 by adjoly #+# #+# */
/* Updated: 2025/06/24 18:02:10 by adjoly ### ########.fr */
/* Updated: 2025/07/01 10:47:05 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -130,11 +130,7 @@ void Server::_handle_resource(size_t i) {
return;
if (!res->isProcessed() && res->isReady()) {
_log->debug("processing resource");
res->process();
// if (res->type() == CGI) {
// } else if (pfd.revents & res->event()) {
// res->process();
// _log->info("processingggg");
// }
}
}