mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 18:38:47 +02:00
「🏗️」 wip: nothing is working anymore
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
[server]
|
[server]
|
||||||
host = "localhost"
|
host = "0.0.0.0"
|
||||||
port = 8080
|
port = 8080
|
||||||
|
|
||||||
[server.location./]
|
[server.location./]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/22 12:17:48 by adjoly #+# #+# */
|
/* Created: 2025/04/22 12:17:48 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 12:42:21 by adjoly ### ########.fr */
|
/* Updated: 2025/04/23 17:24:51 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -30,11 +30,13 @@ class URL {
|
|||||||
|
|
||||||
std::vector<std::string> getSegments(void) { return _path_segments; }
|
std::vector<std::string> getSegments(void) { return _path_segments; }
|
||||||
std::string getFullUrl(void) { return _full_url; }
|
std::string getFullUrl(void) { return _full_url; }
|
||||||
|
std::string getQueryString(void) const { return _query_string; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parse() {
|
void parse() {
|
||||||
size_t scheme_pos = _full_url.find("://");
|
size_t scheme_pos = _full_url.find("://");
|
||||||
size_t path_start = 0;
|
size_t path_start = 0;
|
||||||
|
size_t query_start = _full_url.find('?');
|
||||||
|
|
||||||
if (scheme_pos != std::string::npos) {
|
if (scheme_pos != std::string::npos) {
|
||||||
path_start = _full_url.find('/', scheme_pos + 3);
|
path_start = _full_url.find('/', scheme_pos + 3);
|
||||||
@ -42,9 +44,17 @@ class URL {
|
|||||||
path_start = 0;
|
path_start = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path_start != std::string::npos) {
|
if (query_start != std::string::npos) {
|
||||||
std::string path = _full_url.substr(path_start);
|
_query_string = _full_url.substr(query_start + 1);
|
||||||
splitPath(path, _path_segments);
|
if (path_start != std::string::npos) {
|
||||||
|
std::string path = _full_url.substr(path_start, query_start - path_start);
|
||||||
|
splitPath(path, _path_segments);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (path_start != std::string::npos) {
|
||||||
|
std::string path = _full_url.substr(path_start);
|
||||||
|
splitPath(path, _path_segments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,4 +82,5 @@ class URL {
|
|||||||
|
|
||||||
std::string _full_url;
|
std::string _full_url;
|
||||||
std::vector<std::string> _path_segments;
|
std::vector<std::string> _path_segments;
|
||||||
|
std::string _query_string;
|
||||||
};
|
};
|
||||||
|
@ -1,24 +1,36 @@
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* cgi.hpp :+: :+: :+: */
|
/* Cgi.hpp :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/24 14:17:34 by adjoly #+# #+# */
|
/* Created: 2025/03/24 14:17:34 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 11:51:33 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/23 17:27:45 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <sstream>
|
#include "requests/HttpIMessage.hpp"
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class cgi {
|
namespace webserv {
|
||||||
|
|
||||||
|
|
||||||
|
class Cgi {
|
||||||
public:
|
public:
|
||||||
cgi();
|
Cgi(http::IMessage &);
|
||||||
~cgi(void);
|
~Cgi(void);
|
||||||
|
|
||||||
|
void initEnvp(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
|
std::map<std::string, std::string> _envp;
|
||||||
|
|
||||||
|
|
||||||
std::string _request;
|
std::string _request;
|
||||||
};
|
};
|
||||||
|
};
|
Reference in New Issue
Block a user