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]
|
||||
host = "localhost"
|
||||
host = "0.0.0.0"
|
||||
port = 8080
|
||||
|
||||
[server.location./]
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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::string getFullUrl(void) { return _full_url; }
|
||||
std::string getQueryString(void) const { return _query_string; }
|
||||
|
||||
private:
|
||||
void parse() {
|
||||
size_t scheme_pos = _full_url.find("://");
|
||||
size_t path_start = 0;
|
||||
size_t query_start = _full_url.find('?');
|
||||
|
||||
if (scheme_pos != std::string::npos) {
|
||||
path_start = _full_url.find('/', scheme_pos + 3);
|
||||
@ -42,11 +44,19 @@ class URL {
|
||||
path_start = 0;
|
||||
}
|
||||
|
||||
if (query_start != std::string::npos) {
|
||||
_query_string = _full_url.substr(query_start + 1);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void splitPath(const std::string &path,
|
||||
std::vector<std::string> &segments) const {
|
||||
@ -72,4 +82,5 @@ class URL {
|
||||
|
||||
std::string _full_url;
|
||||
std::vector<std::string> _path_segments;
|
||||
std::string _query_string;
|
||||
};
|
||||
|
@ -1,24 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* cgi.hpp :+: :+: :+: */
|
||||
/* Cgi.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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
|
||||
|
||||
#include <sstream>
|
||||
#include "requests/HttpIMessage.hpp"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class cgi {
|
||||
namespace webserv {
|
||||
|
||||
|
||||
class Cgi {
|
||||
public:
|
||||
cgi();
|
||||
~cgi(void);
|
||||
Cgi(http::IMessage &);
|
||||
~Cgi(void);
|
||||
|
||||
void initEnvp(void);
|
||||
|
||||
protected:
|
||||
private:
|
||||
std::map<std::string, std::string> _envp;
|
||||
|
||||
|
||||
std::string _request;
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user