🏗️」 wip: cgi workinggg

This commit is contained in:
2025-05-27 22:33:04 +02:00
parent 833458e293
commit adde9e0362
25 changed files with 261 additions and 149 deletions

View File

@ -6,14 +6,16 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 17:23:00 by mmoussou #+# #+# */
/* Updated: 2025/05/15 12:12:47 by adjoly ### ########.fr */
/* Updated: 2025/05/27 22:22:56 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <config/URL.hpp>
#include "config/Server.hpp"
#include "cppeleven.hpp"
#include <config/Route.hpp>
#include <config/URL.hpp>
#include <ctime>
#include <fstream>
#include <iostream>
@ -26,13 +28,17 @@
#include <config/default.hpp>
namespace webserv {
namespace server {
class Cgi;
}
namespace http {
class ARequest : public http::IMessage {
public:
virtual ~ARequest(void) {
log("", "ARequest", "destructor called");
delete _url;
if (_url != not_nullptr)
delete _url;
}
virtual void parse(std::string const &data) = 0;
@ -40,24 +46,27 @@ class ARequest : public http::IMessage {
std::string str(void) const;
std::string getMethod(void) const;
std::string getTarget(void) const;
std::string getProtocol(void) const;
webserv::config::Route *getRoute(void) const;
URL getUrl() const;
std::string getMethod(void) const;
std::string getTarget(void) const;
std::string getProtocol(void) const;
webserv::config::Route *getRoute(void) const;
URL getUrl() const;
virtual server::Cgi * getCgi() const { return not_nullptr; }
void setMethod(std::string const method);
void setTarget(std::string const target);
void setProtocol(std::string const protocol);
void setServer(std::string const protocol);
void setRoute(config::Route *route);
void setSrv(config::Server *srv);
protected:
std::string _method;
std::string _target;
std::string _protocol;
webserv::config::Route *_route;
URL *_url;
std::string _method;
std::string _target;
std::string _protocol;
webserv::config::Route *_route;
config::Server * _srv;
URL * _url;
std::string _sanitizeStr(std::string &str) {
std::string newStr = str;