mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 23:48:46 +02:00
「🏗️」 wip: started client handling (need to redo a part of the client fd handling) not yet usable
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */
|
/* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/17 12:46:04 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/17 18:48:25 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ namespace server {
|
|||||||
|
|
||||||
class Client {
|
class Client {
|
||||||
public:
|
public:
|
||||||
Client(int, sockaddr_in, config::Config *);
|
Client(int, sockaddr_in, config::Server *);
|
||||||
~Client(void);
|
~Client(void);
|
||||||
|
|
||||||
void answer(void);
|
void answer(void);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */
|
/* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/17 18:08:38 by adjoly ### ########.fr */
|
/* Updated: 2025/04/17 18:45:07 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class Server {
|
|||||||
*
|
*
|
||||||
* @param The fd of the client
|
* @param The fd of the client
|
||||||
*/
|
*/
|
||||||
void _handle_client(int, sockaddr_in, config::Config *, struct pollfd);
|
void _handle_client(int, sockaddr_in, struct pollfd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Can be used to fill the vector passed as parameters with all the
|
* @brief Can be used to fill the vector passed as parameters with all the
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/17 11:12:41 by mmoussou #+# #+# */
|
/* Created: 2025/04/17 11:12:41 by mmoussou #+# #+# */
|
||||||
/* Updated: 2025/04/17 14:25:50 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/17 18:48:17 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,8 +14,31 @@
|
|||||||
|
|
||||||
using namespace server;
|
using namespace server;
|
||||||
|
|
||||||
Client::Client(int fd, sockaddr_in socket, config::Servr *conf, Logger *log): _fd(fd), _client_addr(socker), _conf(conf), _log(log)
|
/*class Client {
|
||||||
|
public:
|
||||||
|
Client(int, sockaddr_in, config::Config *);
|
||||||
|
~Client(void);
|
||||||
|
|
||||||
|
void answer(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void getRequest(void);
|
||||||
|
|
||||||
|
int _fd;
|
||||||
|
struct sockaddr_in _client_addr;
|
||||||
|
http::IRequest *_request;
|
||||||
|
http::Response *_response;
|
||||||
|
config::Server *_conf;
|
||||||
|
std::string _request_method;
|
||||||
|
};*/
|
||||||
|
|
||||||
|
Client::Client(int fd, sockaddr_in socket, config::Server *conf, Logger *log)
|
||||||
{
|
{
|
||||||
|
this->_fd = fd;
|
||||||
|
this->_client_addr = socket;
|
||||||
|
this->_conf = conf;
|
||||||
|
this->_log = log;
|
||||||
|
|
||||||
std::string received_data;
|
std::string received_data;
|
||||||
char buffer[BUFFER_SIZE];
|
char buffer[BUFFER_SIZE];
|
||||||
ssize_t bytes_received;
|
ssize_t bytes_received;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */
|
/* Created: 2025/04/11 16:11:40 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/17 18:21:34 by adjoly ### ########.fr */
|
/* Updated: 2025/04/17 18:57:20 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* socket.cpp :+: :+: :+: */
|
/* Socket.cpp :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
|
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/17 12:35:31 by adjoly ### ########.fr */
|
/* Updated: 2025/04/17 19:03:27 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "server/Client.hpp"
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <server/default.hpp>
|
#include <server/default.hpp>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
@ -69,3 +71,7 @@ int Server::_createSocket(std::string host, int port) {
|
|||||||
|
|
||||||
return (fd);
|
return (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Server::_handle_client(int fd, sockaddr_in client_addr, struct pollfd poll_fd) {
|
||||||
|
server::Client *client = new server::Client(fd, client_addr, );
|
||||||
|
}
|
Reference in New Issue
Block a user