_request() and _response() refactoring

+ Wip redirection (weird behavior)
+ 505 HTTP Version Not Supported
This commit is contained in:
LuckyLaszlo
2022-08-09 01:46:59 +02:00
parent a44b9b493a
commit 643b09c4f7
8 changed files with 118 additions and 60 deletions

View File

@@ -72,36 +72,29 @@ class Webserv
void _accept_connection(listen_socket &lsocket);
// request.cpp
void _request(Client *client);
void _read_request(Client *client);
int _read_request(Client *client);
// response.cpp
void _response(Client *client);
void _send_response(Client *client);
int _send_response(Client *client);
void _append_base_headers(Client *client);
void _construct_response(Client *client);
void _process_method(Client *client);
void _insert_status_line(Client *client);
void _error_html_response(Client *client);
void _append_body(Client *client, const std::string &body, const std::string &file_extension = "");
void _get(Client *client);
// void _get(Client *client, ServerConfig &server, LocationConfig &location);
// in progress
void _autoindex(Client *client, std::string &path);
void _get_file(Client *client, const std::string &path);
void _post(Client *client);
void _post_file(Client *client, const std::string &path);
void _delete(Client *client);
void _delete_file(Client *client, const std::string &path);
ServerConfig *_determine_process_server(Client *client); // cant be const cause of error_pages.operator[]
const LocationConfig *_determine_location(const ServerConfig &server, const std::string &path) const;
std::string _determine_file_extension(const std::string &path) const;
// method_get.cpp
void _get(Client *client);
void _get_file(Client *client, const std::string &path);
void _autoindex(Client *client, std::string &path);
// method_post.cpp
void _post(Client *client);
void _post_file(Client *client, const std::string &path);
// method_delete.cpp
void _delete(Client *client);
void _delete_file(Client *client, const std::string &path);
// cgi_script.cpp
bool _is_cgi(Client *client);
void _exec_cgi(Client *client);