」 feat(server/client): added Client class :D

This commit is contained in:
y-syo
2025-04-17 13:11:18 +02:00
parent 2004386c8d
commit a407ee51a3
4 changed files with 120 additions and 101 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/16 17:51:46 by mmoussou #+# #+# */
/* Updated: 2025/03/24 15:05:53 by mmoussou ### ########.fr */
/* Updated: 2025/04/17 13:10:22 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,16 +22,10 @@
namespace webserv {
namespace http {
/*
* DOES NOT WORK
* still need to do uh things but base is done at least :D
*/
class Errors {
public:
//static http::Response &getRequest(int error_code);
static std::string getResponseBody(int error_code);
static void setEntry(const std::string &key, int value);
static void setEntries(const std::map<int, std::string>);
static std::map<int, std::string> message;
private:

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */
/* Updated: 2025/04/14 15:00:41 by adjoly ### ########.fr */
/* Updated: 2025/04/17 12:46:04 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,16 +18,26 @@
#include <netinet/in.h>
#include <webserv.hpp>
namespace webserv {
namespace server {
class Client {
public:
Client(int, sockaddr_in);
Client(int, sockaddr_in, config::Config *);
~Client(void);
void answer(void);
private:
void _getRequest(std::string);
int _fd;
struct sockaddr_in _client_addr;
http::IRequest *_request;
http::Response *_response;
config::Config *_conf;
config::Server *_conf;
Logger *_log;
};
} // -namespace server
} // -namespace webserv