mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-03-15 08:06:49 +01:00
「🏗️」 wip: work in progress, not done yet.
This commit is contained in:
@ -1,20 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* default.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 13:42:04 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:43:13 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WEBSERV_DEFAULT_HPP__
|
||||
# define __WEBSERV_DEFAULT_HPP__
|
||||
|
||||
using namespace webserv; // oh no, cringo D:
|
||||
|
||||
#endif //__WEBSERV_DEFAULT_HPP__
|
45
includes/requests/HttpIMessage.hpp
Normal file
45
includes/requests/HttpIMessage.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* HttpIMessage.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 22:13:38 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 22:20:53 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
#ifndef __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__
|
||||
# define __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace webserv {
|
||||
namespace http {
|
||||
|
||||
class IMessage {
|
||||
public:
|
||||
virtual std::map<std::string, std::string> getHeaders(void) const;
|
||||
virtual std::string getBody(void) const;
|
||||
|
||||
virtual void setHeaders(std::map<std::string, std::string> 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<std::string, std::string> _headers;
|
||||
std::string _body;
|
||||
|
||||
};
|
||||
|
||||
} // -namespace http
|
||||
} // -namespace webserv
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_HTTP_IMESSAGE_HPP__
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 17:23:00 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:49:50 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/02/11 22:18:34 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,7 +14,12 @@
|
||||
#ifndef __WEBSERV_REQUESTS_HTTP_REQUEST_HPP__
|
||||
# define __WEBSERV_REQUESTS_HTTP_REQUEST_HPP__
|
||||
|
||||
#include "requests/default.hpp"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <requests/HttpIMessage.hpp>
|
||||
#include <requests/HttpResponse.hpp>
|
||||
|
||||
namespace webserv {
|
||||
namespace http {
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 17:21:20 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:43:52 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/02/11 22:21:52 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#ifndef __WEBSERV_REQUESTS_HTTP_RESPONSE_HPP__
|
||||
# define __WEBSERV_REQUESTS_HTTP_RESPONSE_HPP__
|
||||
|
||||
#include "requests/default.hpp"
|
||||
#include <requests/HttpIMessage.hpp>
|
||||
|
||||
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;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 15:48:22 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:50:43 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/02/11 22:21:21 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,37 +14,7 @@
|
||||
#ifndef __WEBSERV_REQUESTS_DEFAULT_HPP__
|
||||
# define __WEBSERV_REQUESTS_DEFAULT_HPP__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "default.hpp"
|
||||
#include "requests/HttpRequest.hpp"
|
||||
#include "requests/HttpResponse.hpp"
|
||||
|
||||
namespace webserv {
|
||||
namespace http {
|
||||
|
||||
class IMessage {
|
||||
public:
|
||||
virtual std::map<std::string, std::string> getHeaders(void) const;
|
||||
virtual std::string getBody(void) const;
|
||||
|
||||
virtual void setHeaders(std::map<std::string, std::string> 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<std::string, std::string> _headers;
|
||||
std::string _body;
|
||||
|
||||
};
|
||||
|
||||
} // -namespace http
|
||||
} // -namespace webserv
|
||||
#include <requests/HttpRequest.hpp>
|
||||
#include <requests/HttpResponse.hpp>
|
||||
|
||||
#endif // __WEBSERV_REQUESTS_DEFAULT_HPP__
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 13:29:05 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:43:26 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/02/11 15:00:15 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,8 +14,6 @@
|
||||
#ifndef __WEBSERV_SERVER_DEFAULT_HPP__
|
||||
# define __WEBSERV_SERVER_DEFAULT_HPP__
|
||||
|
||||
#include "default.hpp"
|
||||
|
||||
namespace webserv {
|
||||
namespace server {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/11 13:29:21 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:43:20 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/02/11 15:00:10 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */
|
||||
/* Updated: 2025/02/11 13:39:14 by mmoussou ### ########.fr */
|
||||
/* Updated: 2025/02/11 14:54:22 by mmoussou ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "webserv.hpp"
|
||||
#include "requests/default.hpp"
|
||||
#include <webserv.hpp>
|
||||
#include <requests/default.hpp>
|
||||
|
||||
#define PORT 8080
|
||||
#define BUFFER_SIZE 4096
|
||||
|
Reference in New Issue
Block a user