From 354b5f01f309a6f182b18b055ad751ef435bb926 Mon Sep 17 00:00:00 2001 From: y-syo Date: Tue, 11 Feb 2025 22:26:50 +0100 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20work=20in=20progress,=20not=20done=20yet.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/default.hpp | 20 ------------- includes/requests/HttpIMessage.hpp | 45 ++++++++++++++++++++++++++++++ includes/requests/HttpRequest.hpp | 9 ++++-- includes/requests/HttpResponse.hpp | 6 ++-- includes/requests/default.hpp | 36 ++---------------------- includes/server/default.hpp | 4 +-- includes/webserv.hpp | 2 +- src/main.cpp | 6 ++-- 8 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 includes/default.hpp create mode 100644 includes/requests/HttpIMessage.hpp diff --git a/includes/default.hpp b/includes/default.hpp deleted file mode 100644 index fc55644..0000000 --- a/includes/default.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* default.hpp :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: mmoussou +#include + +namespace webserv { +namespace http { + +class IMessage { +public: + virtual std::map getHeaders(void) const; + virtual std::string getBody(void) const; + + virtual void setHeaders(std::map const headers); + virtual void setBody(std::string const body); + + virtual void addHeader(std::string const name, std::string const value); + virtual void rmHeader(std::string const name); + + virtual std::string str(void) const = 0; + +protected: + std::map _headers; + std::string _body; + +}; + +} // -namespace http +} // -namespace webserv + +#endif // __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__ diff --git a/includes/requests/HttpRequest.hpp b/includes/requests/HttpRequest.hpp index 18b60c8..7b4911c 100644 --- a/includes/requests/HttpRequest.hpp +++ b/includes/requests/HttpRequest.hpp @@ -6,7 +6,7 @@ /* By: mmoussou +#include +#include + +#include +#include namespace webserv { namespace http { diff --git a/includes/requests/HttpResponse.hpp b/includes/requests/HttpResponse.hpp index b618248..9db5b92 100644 --- a/includes/requests/HttpResponse.hpp +++ b/includes/requests/HttpResponse.hpp @@ -6,7 +6,7 @@ /* By: mmoussou namespace webserv { namespace http { @@ -41,6 +41,8 @@ public: void setStatusCode(size_t const status_code); void setStatusText(std::string const status_text); + std::string str(void) const; + private: std::string _protocol; size_t _status_code; diff --git a/includes/requests/default.hpp b/includes/requests/default.hpp index 220f40c..946cda1 100644 --- a/includes/requests/default.hpp +++ b/includes/requests/default.hpp @@ -6,7 +6,7 @@ /* By: mmoussou -#include -#include -#include -#include - -#include "default.hpp" -#include "requests/HttpRequest.hpp" -#include "requests/HttpResponse.hpp" - -namespace webserv { -namespace http { - -class IMessage { -public: - virtual std::map getHeaders(void) const; - virtual std::string getBody(void) const; - - virtual void setHeaders(std::map const headers); - virtual void setBody(std::string const body); - - virtual void addHeader(std::string const name, std::string const value); - virtual void rmHeader(std::string const name); - -protected: - std::map _headers; - std::string _body; - -}; - -} // -namespace http -} // -namespace webserv +#include +#include #endif // __WEBSERV_REQUESTS_DEFAULT_HPP__ diff --git a/includes/server/default.hpp b/includes/server/default.hpp index 5ca19f5..f648bec 100644 --- a/includes/server/default.hpp +++ b/includes/server/default.hpp @@ -6,7 +6,7 @@ /* By: mmoussou +#include #define PORT 8080 #define BUFFER_SIZE 4096