added debug print

This commit is contained in:
Hugo LAMY
2022-08-14 16:17:24 +02:00
parent be499328f6
commit d663a4c7e6
3 changed files with 10 additions and 13 deletions

View File

@@ -44,6 +44,8 @@ int Webserv::_send_response(Client *client)
if (client->status >= 400)
_error_html_response(client);
/*DEBUG*/ std::cout << "\n" B_PURPLE "[response + output + headers]:" RESET "\n"; ::print_special(client->response); std::cout << B_PURPLE "-----------" RESET "\n\n";
std::cerr << "client->response.size() = " << client->response.size() << "\n"; // DEBUG
ret = ::send(client->get_cl_fd(), client->response.c_str(), client->response.size(), 0);
if (ret == -1)
@@ -77,8 +79,15 @@ void Webserv::_construct_response(Client *client)
if (_is_cgi(client, path))
{
script_output = _exec_cgi(client);
/*DEBUG*/ std::cout << "\n" B_PURPLE "[script output]:" RESET "\n"; ::print_special(script_output); std::cout << B_PURPLE "-----------" RESET "\n\n";
/*DEBUG*/ std::cout << "\n" B_PURPLE "[response]:" RESET "\n"; ::print_special(client->response); std::cout << B_PURPLE "-----------" RESET "\n\n";
_check_script_output(client, script_output);
client->response += script_output;
/*DEBUG*/ std::cout << "\n" B_PURPLE "[response + output]:" RESET "\n"; ::print_special(client->response); std::cout << B_PURPLE "-----------" RESET "\n\n";
return;
}
_process_method(client, path);