mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-11 22:58:47 +02:00
「✏️」 norm(includes): cleaned headers
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cppeleven.hpp"
|
||||
#include "log.hpp"
|
||||
#include <log.hpp>
|
||||
#include "node/default.hpp"
|
||||
#include <config/default.hpp>
|
||||
#include <map>
|
||||
|
@ -6,11 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/10 13:08:36 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/11 11:39:00 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:47:39 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "log.hpp"
|
||||
#include <log.hpp>
|
||||
#include <fstream>
|
||||
#include <help.hpp>
|
||||
#include <sys/stat.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/17 11:12:41 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/20 11:07:47 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 12:01:16 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
using namespace server;
|
||||
|
||||
Client::Client(int fd, sockaddr_in socket, config::Server *conf): _fd(fd), _client_addr(socket), _conf(conf)
|
||||
Client::Client(int fd, sockaddr_in socket, config::Config *conf): _fd(fd), _client_addr(socket)
|
||||
{
|
||||
std::string received_data;
|
||||
char buffer[BUFFER_SIZE];
|
||||
@ -35,6 +35,12 @@ Client::Client(int fd, sockaddr_in socket, config::Server *conf): _fd(fd), _clie
|
||||
|
||||
|
||||
this->_getRequest(received_data);
|
||||
|
||||
this->_conf = conf->getServer(this->_request->getHeaders()["Host"]);
|
||||
|
||||
|
||||
//if (received_data.length > (get max_body_size from Route corresponding) )
|
||||
// throw error
|
||||
}
|
||||
|
||||
void Client::_getRequest(std::string request_str)
|
||||
@ -67,6 +73,7 @@ void Client::_getRequest(std::string request_str)
|
||||
void Client::answer(void)
|
||||
{
|
||||
std::string response;
|
||||
(void) _client_addr;
|
||||
|
||||
if (this->_request->getMethod() == "GET" || this->_request->getMethod() == "DELETE" || this->_request->getMethod() == "POST")
|
||||
response = this->_request->execute().str();
|
||||
|
@ -1,16 +1,16 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Socket.cpp :+: :+: :+: */
|
||||
/* ServerUtils.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/17 11:58:42 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/21 10:53:45 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:46:07 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "server/Client.hpp"
|
||||
#include <server/Client.hpp>
|
||||
#include <netinet/in.h>
|
||||
#include <server/default.hpp>
|
||||
#include <sys/socket.h>
|
||||
@ -81,7 +81,7 @@ bool Server::_handle_client(struct pollfd &pollfd, sockaddr_in *sock_data) {
|
||||
Client *client;
|
||||
|
||||
try {
|
||||
client = new Client(pollfd.fd, sock_data, _conf);
|
||||
client = new Client(pollfd.fd, *sock_data, _conf);
|
||||
client->answer();
|
||||
} catch (std::exception &e) {
|
||||
_log->error(e.what());
|
||||
|
Reference in New Issue
Block a user