littles adjustements but still no solution to the main problem

This commit is contained in:
lperrey
2022-08-18 10:48:57 +02:00
parent dda0103fb8
commit 9b0fcc1520
8 changed files with 88 additions and 33 deletions

View File

@@ -73,11 +73,6 @@ int Webserv::_send_response(Client *client)
std::cerr << "SEND RET 0 for client.fd =" << client->get_cl_fd() << "\n"; // DEBUG
return SEND_CLOSE;
}
if (ret < (int)client->response.size())
{
std::cerr << "send() as not send all data, IT CAN HAPPEN !" << "\n"; // DEBUG
throw ExecFail(); // DEBUG, TODO, A ENLEVER ABSOLEMENT, WHILE TEMP =D
}
// /* Debug */ std::cerr << "ret send() = " << ret << "\n"; // DEBUG
return SEND_COMPLETE;
@@ -85,6 +80,8 @@ int Webserv::_send_response(Client *client)
void Webserv::_append_base_headers(Client *client)
{
std::cerr << "_append_base_headers()\n"; // debug
client->response.append("Server: Webserv/0.1" CRLF);
if (client->get_rq_headers("Connection") == "close"
@@ -104,17 +101,9 @@ void Webserv::_construct_response(Client *client)
path = _replace_url_root(client, client->get_rq_abs_path());
if (client->cgi_state == CGI_READY_TO_EXEC)
{
std::string body = client->get_rq_body();
std::cerr << "client.fd for write body =" << client->get_cl_fd() << "\n"; // DEBUG
std::cerr << "client.cgi_pipe_w_to_child for write body =" << client->cgi_pipe_w_to_child << "\n"; // DEBUG
if (::write(client->cgi_pipe_w_to_child, body.c_str(), body.size()) == -1)
{
std::perror("err write()");
_close_client_cgi_pipes(client);
client->status = 500;
client->cgi_state = CGI_NO_CGI;
_write_body_to_cgi(client);
if (client->status)
return;
}
_exec_cgi(client);
}
else if (client->cgi_state == CGI_OUTPUT_COMPLETE)