mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 16:38:46 +02:00
「✏️」 norm(includes): cleaned headers
This commit is contained in:
@ -6,13 +6,14 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/24 14:17:34 by adjoly #+# #+# */
|
||||
/* Updated: 2025/03/24 14:20:00 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:51:33 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
|
||||
class cgi {
|
||||
public:
|
||||
cgi();
|
||||
|
@ -6,13 +6,13 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/14 12:20:06 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/22 10:57:26 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:52:33 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config/default.hpp"
|
||||
#include <config/default.hpp>
|
||||
|
||||
namespace webserv {
|
||||
namespace config {
|
||||
|
@ -6,15 +6,15 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/18 10:05:22 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:49:19 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cppeleven.hpp"
|
||||
#include "log.hpp"
|
||||
#include "node/default.hpp"
|
||||
#include <cppeleven.hpp>
|
||||
#include <log.hpp>
|
||||
#include <node/default.hpp>
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
|
@ -6,16 +6,16 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/19 14:11:28 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/22 10:59:27 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 12:02:36 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config/default.hpp"
|
||||
#include "cppeleven.hpp"
|
||||
#include "node/ANode.hpp"
|
||||
#include "webserv.hpp"
|
||||
#include <config/default.hpp>
|
||||
#include <cppeleven.hpp>
|
||||
#include <node/ANode.hpp>
|
||||
#include <webserv.hpp>
|
||||
|
||||
namespace webserv {
|
||||
namespace config {
|
||||
|
@ -6,18 +6,18 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/19 14:15:51 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/14 12:54:29 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 12:03:30 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Route.hpp"
|
||||
#include "Server.hpp"
|
||||
#include "Config.hpp"
|
||||
#include "cppeleven.hpp"
|
||||
#include "node/Table.hpp"
|
||||
#include "node/default.hpp"
|
||||
#include <config/Route.hpp>
|
||||
#include <config/Server.hpp>
|
||||
#include <config/Config.hpp>
|
||||
#include <cppeleven.hpp>
|
||||
#include <node/Table.hpp>
|
||||
#include <node/default.hpp>
|
||||
#include <tomlpp.hpp>
|
||||
|
||||
namespace webserv {
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/20 09:28:27 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/18 10:03:06 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:50:42 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -6,13 +6,11 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/16 17:51:46 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/17 13:10:22 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:52:00 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
#ifndef __WEBSERV_REQUESTS_ERRORS_HPP__
|
||||
# define __WEBSERV_REQUESTS_ERRORS_HPP__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -37,5 +35,3 @@ private:
|
||||
|
||||
} // -namespace http
|
||||
} // -namespace webserv
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_ERRORS_HPP__
|
||||
|
@ -6,13 +6,11 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 22:13:38 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/02 01:47:24 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:52:05 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
#ifndef __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__
|
||||
# define __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -43,5 +41,3 @@ protected:
|
||||
|
||||
} // -namespace http
|
||||
} // -namespace webserv
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__
|
||||
|
@ -6,13 +6,11 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 17:23:00 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/20 11:19:31 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:52:16 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
#ifndef __WEBSERV_REQUESTS_HTTP_REQUEST_HPP__
|
||||
# define __WEBSERV_REQUESTS_HTTP_REQUEST_HPP__
|
||||
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
@ -22,6 +20,8 @@
|
||||
#include <requests/HttpIMessage.hpp>
|
||||
#include <requests/HttpResponse.hpp>
|
||||
|
||||
#include <config/default.hpp>
|
||||
|
||||
namespace webserv {
|
||||
namespace http {
|
||||
|
||||
@ -37,15 +37,18 @@ public:
|
||||
std::string getMethod(void) const;
|
||||
std::string getTarget(void) const;
|
||||
std::string getProtocol(void) const;
|
||||
config::Server *getConfig(void) const;
|
||||
|
||||
void setMethod(std::string const method);
|
||||
void setTarget(std::string const target);
|
||||
void setProtocol(std::string const protocol);
|
||||
void setServer(std::string const protocol);
|
||||
|
||||
protected:
|
||||
std::string _method;
|
||||
std::string _target;
|
||||
std::string _protocol;
|
||||
config::Server *_conf;
|
||||
|
||||
};
|
||||
|
||||
@ -87,5 +90,3 @@ public:
|
||||
|
||||
} // -namespace http
|
||||
} // -namespace webserv
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_HTTP_REQUEST_HPP__
|
||||
|
@ -6,13 +6,11 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 17:21:20 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/20 12:35:51 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:52:22 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
#ifndef __WEBSERV_REQUESTS_HTTP_RESPONSE_HPP__
|
||||
# define __WEBSERV_REQUESTS_HTTP_RESPONSE_HPP__
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -46,5 +44,3 @@ private:
|
||||
|
||||
} // -namespace http
|
||||
} // -namespace webserv
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_HTTP_RESPONSE_HPP__
|
||||
|
@ -6,18 +6,14 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 15:48:22 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/03/17 14:08:50 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:51:54 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
#ifndef __WEBSERV_REQUESTS_DEFAULT_HPP__
|
||||
# define __WEBSERV_REQUESTS_DEFAULT_HPP__
|
||||
|
||||
#include <requests/Errors.hpp>
|
||||
#include <requests/HttpRequest.hpp>
|
||||
#include <requests/HttpResponse.hpp>
|
||||
|
||||
using namespace webserv;
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_DEFAULT_HPP__
|
||||
|
@ -6,15 +6,15 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/14 14:14:39 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/20 11:25:37 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/04/22 12:04:57 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config/default.hpp"
|
||||
#include "default.hpp"
|
||||
#include "requests/default.hpp"
|
||||
#include <config/default.hpp>
|
||||
#include <server/default.hpp>
|
||||
#include <requests/default.hpp>
|
||||
#include <netinet/in.h>
|
||||
#include <webserv.hpp>
|
||||
|
||||
@ -23,7 +23,7 @@ namespace server {
|
||||
|
||||
class Client {
|
||||
public:
|
||||
Client(int, sockaddr_in, config::Server *);
|
||||
Client(int, sockaddr_in, config::Config *);
|
||||
virtual ~Client(void);
|
||||
|
||||
void answer(void);
|
||||
|
@ -6,13 +6,13 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/11 17:45:43 by adjoly #+# #+# */
|
||||
/* Updated: 2025/04/21 10:46:31 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:51:27 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "log.hpp"
|
||||
#include <log.hpp>
|
||||
#include <config/default.hpp>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -6,14 +6,14 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 13:29:05 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/17 11:05:59 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 12:04:53 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Server.hpp"
|
||||
#include "Client.hpp"
|
||||
#include <server/Server.hpp>
|
||||
#include <server/Client.hpp>
|
||||
|
||||
namespace webserv {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 13:29:21 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/04/21 11:33:14 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/04/22 11:54:13 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -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