clean comment and stuff
This commit is contained in:
@@ -101,7 +101,6 @@ void Webserv::_cgi_open_pipes(Client *client)
|
||||
|
||||
void Webserv::_write_body_to_cgi(Client *client)
|
||||
{
|
||||
std::cerr << "_write_body_to_cgi()"; // DEBUG
|
||||
ssize_t ret;
|
||||
std::string body = client->get_rq_body();
|
||||
|
||||
@@ -157,25 +156,24 @@ std::string Webserv::_dup_env(std::string var, int i)
|
||||
return (str);
|
||||
}
|
||||
|
||||
// TODO : verifier que les variables sont corrects
|
||||
/*
|
||||
https://www.rfc-editor.org/rfc/rfc3875#section-4.1
|
||||
*/
|
||||
void Webserv::_set_env_vector(Client *client, std::vector<std::string> &env_vector)
|
||||
{
|
||||
env_vector.push_back(_dup_env("AUTH_TYPE")); // authentification not supporte
|
||||
env_vector.push_back(_dup_env("AUTH_TYPE")); // authentification not supported
|
||||
env_vector.push_back(_dup_env("CONTENT_LENGTH" , client->get_rq_body().size()));
|
||||
env_vector.push_back(_dup_env("CONTENT_TYPE" , client->get_rq_headers("Content-Type")));
|
||||
env_vector.push_back(_dup_env("GATEWAY_INTERFACE" , "CGI/1.1")); // https://www.rfc-editor.org/rfc/rfc3875#section-4.1.4
|
||||
env_vector.push_back(_dup_env("PATH_INFO" , client->get_rq_script_info())); // LUKE: To Check
|
||||
env_vector.push_back(_dup_env("PATH_TRANSLATED")); // not supported // LUKE: Why not supported ?
|
||||
env_vector.push_back(_dup_env("PATH_INFO" , client->get_rq_script_info()));
|
||||
env_vector.push_back(_dup_env("PATH_TRANSLATED")); // not used
|
||||
env_vector.push_back(_dup_env("QUERY_STRING" , client->get_rq_query()));
|
||||
env_vector.push_back(_dup_env("REMOTE_ADDR" , client->get_cl_ip()));
|
||||
env_vector.push_back(_dup_env("REMOTE_HOST" , client->get_cl_ip())); // equal to REMOTE_ADDR or empty
|
||||
env_vector.push_back(_dup_env("REMOTE_IDENT")); // authentification not supported
|
||||
env_vector.push_back(_dup_env("REMOTE_USER")); // authentification not supported
|
||||
env_vector.push_back(_dup_env("REQUEST_METHOD" , client->get_rq_method_str()));
|
||||
env_vector.push_back(_dup_env("SCRIPT_NAME" , "/" + client->get_rq_script_path())); // LUKE: To Check
|
||||
env_vector.push_back(_dup_env("SCRIPT_NAME" , "/" + client->get_rq_script_path()));
|
||||
env_vector.push_back(_dup_env("SERVER_NAME" , client->get_cl_lsocket()->host));
|
||||
env_vector.push_back(_dup_env("SERVER_PORT" , client->get_cl_lsocket()->port));
|
||||
env_vector.push_back(_dup_env("SERVER_PROTOCOL" , "HTTP/1.1"));
|
||||
@@ -279,15 +277,10 @@ void Webserv::_check_script_output(Client *client, std::string & output)
|
||||
_check_script_status(client, output);
|
||||
if (client->status >= 400 && client->status < 600)
|
||||
return;
|
||||
// /*DEBUG*/ std::cout << "\n" B_PURPLE "[script status]:\n" << "client->status:[" << client->status << "]" RESET "\n"; ::print_special(output); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||
client->status = _check_script_fields(output, client->status);
|
||||
// /*DEBUG*/ std::cout << "\n" B_PURPLE "[script fields]:\n" << "client->status:[" << client->status << "]" RESET "\n"; ::print_special(output); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||
_check_fields_duplicates(client, output);
|
||||
// /*DEBUG*/ std::cout << "\n" B_PURPLE "[fields duplicates]:\n" << "client->status:[" << client->status << "]" RESET "\n"; ::print_special(output); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||
_remove_body_leading_empty_lines(output);
|
||||
// /*DEBUG*/ std::cout << "\n" B_PURPLE "[script empty lines]:\n" << "client->status:[" << client->status << "]" RESET "\n"; ::print_special(output); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||
_add_script_body_length_header(output);
|
||||
// /*DEBUG*/ std::cout << "\n" B_PURPLE "[script content length]:\n" << "client->status:[" << client->status << "]" RESET "\n"; ::print_special(output); std::cout << B_PURPLE "-----------" RESET "\n\n";
|
||||
}
|
||||
|
||||
void Webserv::_check_script_status(Client *client, std::string & output)
|
||||
@@ -424,4 +417,3 @@ void Webserv::_add_script_body_length_header(std::string & output)
|
||||
tmp += CRLF;
|
||||
output.insert(0, tmp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user