cgi scrip with 10 tests
+ if http error status, script output not appended to respons
This commit is contained in:
@@ -47,7 +47,7 @@ int Webserv::_send_response(Client *client)
|
|||||||
if (client->status >= 400)
|
if (client->status >= 400)
|
||||||
_error_html_response(client);
|
_error_html_response(client);
|
||||||
|
|
||||||
// /*DEBUG*/ std::cout << "\n" B_PURPLE "[response + output + headers]:" RESET "\n"; ::print_special(client->response); std::cout << "\n" B_PURPLE "-----------" RESET "\n\n";
|
//*DEBUG*/ std::cout << "\n" B_PURPLE "[response + output + headers]:" RESET "\n"; ::print_special(client->response); std::cout << "\n" B_PURPLE "-----------" RESET "\n\n";
|
||||||
|
|
||||||
std::cerr << "client->response.size() = " << client->response.size() << "\n"; // DEBUG
|
std::cerr << "client->response.size() = " << client->response.size() << "\n"; // DEBUG
|
||||||
ret = ::send(client->get_cl_fd(), client->response.c_str(), client->response.size(), 0);
|
ret = ::send(client->get_cl_fd(), client->response.c_str(), client->response.size(), 0);
|
||||||
@@ -90,13 +90,12 @@ void Webserv::_construct_response(Client *client)
|
|||||||
if (_is_cgi(client, path))
|
if (_is_cgi(client, path))
|
||||||
{
|
{
|
||||||
script_output = _exec_cgi(client);
|
script_output = _exec_cgi(client);
|
||||||
///*DEBUG*/ std::cout << "\n" B_PURPLE "[response]:" RESET "\n"; ::print_special(client->response); 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";
|
||||||
///*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 "[script output]:" RESET "\n"; ::print_special(script_output); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||||
_check_script_output(client, script_output);
|
_check_script_output(client, script_output);
|
||||||
if (client->status < 400)
|
if (client->status < 400)
|
||||||
client->response += script_output;
|
client->response += script_output;
|
||||||
///*DEBUG*/ std::cout << B_YELLOW "inside cgi" RESET "\n";
|
//*DEBUG*/ std::cout << "\n" B_PURPLE "[response + output]:" RESET "\n"; ::print_special(client->response); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||||
///*DEBUG*/ std::cout << "\n" B_PURPLE "[response + output]:" RESET "\n"; ::print_special(client->response); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user