mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-06-25 09:33:36 +02:00
「🏗️」 wip: cgi workinggg
This commit is contained in:
@ -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;
|
||||
|
@ -6,10 +6,11 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/30 09:30:15 by adjoly #+# #+# */
|
||||
/* Updated: 2025/05/27 16:49:00 by adjoly ### ########.fr */
|
||||
/* Updated: 2025/05/27 22:23:15 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <cstddef>
|
||||
#include <requests/ARequest.hpp>
|
||||
|
||||
namespace webserv {
|
||||
@ -22,16 +23,19 @@ namespace http {
|
||||
class Get : public ARequest {
|
||||
public:
|
||||
Get(void) {}
|
||||
Get(std::string &data);
|
||||
Get(std::string &data, config::Server *srv);
|
||||
|
||||
void parse(std::string const &data);
|
||||
|
||||
Response execute(void);
|
||||
|
||||
// private:
|
||||
// server::Cgi *_cgi;
|
||||
server::Cgi *getCgi() const { return _cgi; }
|
||||
|
||||
private:
|
||||
server::Cgi *_cgi;
|
||||
};
|
||||
|
||||
// TODO: pass _srv to other
|
||||
class Post : public ARequest {
|
||||
public:
|
||||
Post(void) {}
|
||||
|
Reference in New Issue
Block a user