🔨」 fix: fixed issue with mainloop where it received empty request

This commit is contained in:
2025-05-28 11:06:19 +02:00
parent adde9e0362
commit 570ade97b4
11 changed files with 79 additions and 50 deletions

View File

@ -6,10 +6,11 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/30 09:42:18 by adjoly #+# #+# */
/* Updated: 2025/05/27 22:23:22 by adjoly ### ########.fr */
/* Updated: 2025/05/28 09:55:54 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "cppeleven.hpp"
#include <algorithm>
#include <dirent.h>
#include <sys/stat.h>
@ -19,7 +20,11 @@
using namespace webserv::http;
Delete::Delete(std::string &data) { this->parse(data); }
Delete::Delete(std::string &data) {
_url = not_nullptr;
_srv = not_nullptr;
this->parse(data);
}
void Delete::parse(std::string const &data) {
std::istringstream stream(data);
@ -91,4 +96,3 @@ Response Delete::execute(void) {
return (response);
}

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/30 09:40:16 by adjoly #+# #+# */
/* Updated: 2025/05/27 22:32:40 by adjoly ### ########.fr */
/* Updated: 2025/05/28 10:00:45 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -34,6 +34,11 @@ Get::Get(std::string &data, config::Server *srv) {
this->parse(data);
}
Get::~Get(void) {
// if (_url != not_nullptr)
// delete _url;
}
void Get::parse(std::string const &data) {
std::istringstream stream(data);
std::string line;
@ -276,5 +281,6 @@ body {\n\
http::Errors::getResponseBody(response.getStatusCode()));
}
delete _url;
return (response);
}

View File

@ -6,10 +6,11 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/30 09:50:20 by adjoly #+# #+# */
/* Updated: 2025/05/27 22:23:36 by adjoly ### ########.fr */
/* Updated: 2025/05/28 09:55:37 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "cppeleven.hpp"
#include <algorithm>
#include <dirent.h>
#include <sys/stat.h>
@ -21,7 +22,12 @@
using namespace webserv::http;
Post::Post(std::string &data) { this->parse(data); }
Post::Post(std::string &data, config::Server *srv) {
_url = not_nullptr;
_srv = srv;
_cgi = not_nullptr;
this->parse(data);
}
void Post::parse(std::string const &data) {
std::istringstream stream(data);