default and custom error pages response
+ refactoring in response.cpp (functions split) + added Client::clear() + added replace_all_substr() in utils.cpp
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
# include "Client.hpp"
|
||||
# include "ServerConfig.hpp"
|
||||
# include "utils.hpp"
|
||||
# include "http_status.hpp"
|
||||
|
||||
extern bool g_run;
|
||||
extern int g_last_signal;
|
||||
@@ -60,6 +61,7 @@ class Webserv
|
||||
std::vector<int> _listen_sockets;
|
||||
std::vector<ServerConfig> _servers;
|
||||
std::vector<Client> _clients;
|
||||
std::map<int, std::string> _http_status;
|
||||
|
||||
// accept.cpp
|
||||
void _accept_connection(int fd);
|
||||
@@ -69,11 +71,20 @@ class Webserv
|
||||
// response.cpp
|
||||
void _response(Client *client);
|
||||
void _send_response(Client *client, ServerConfig &server);
|
||||
|
||||
void _append_base_headers(Client *client);
|
||||
void _construct_response(Client *client, ServerConfig &server);
|
||||
void _insert_status_line(Client *client, ServerConfig &server);
|
||||
void _get_ressource(Client *client, ServerConfig &server, LocationConfig &location);
|
||||
void _process_method(Client *client, ServerConfig &server, LocationConfig &location);
|
||||
void _insert_status_line(Client *client);
|
||||
void _error_html_response(Client *client, ServerConfig &server);
|
||||
|
||||
void _get(Client *client, ServerConfig &server, LocationConfig &location);
|
||||
void _get_file(Client *client, const std::string &path);
|
||||
void _append_body(Client *client, const char *body, size_t body_size);
|
||||
|
||||
void _post(Client *client, ServerConfig &server, LocationConfig &location);
|
||||
void _delete(Client *client, ServerConfig &server, LocationConfig &location);
|
||||
|
||||
ServerConfig &_determine_process_server(Client *client);
|
||||
LocationConfig &_determine_location(ServerConfig &server, std::string &path);
|
||||
// cgi_script.cpp
|
||||
@@ -94,6 +105,7 @@ class Webserv
|
||||
// init.cpp
|
||||
void _bind(int socket_fd, in_port_t port, std::string host);
|
||||
void _listen(int socket_fd, unsigned int max_connections);
|
||||
void _init_http_status_map();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user