🔨」 fix: fixed first segfault

This commit is contained in:
2025-04-22 15:34:13 +02:00
parent 7abe04bf44
commit 5d1c3910bc
9 changed files with 28 additions and 17 deletions

View File

@ -6,10 +6,11 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */
/* Updated: 2025/04/22 14:31:34 by adjoly ### ########.fr */
/* Updated: 2025/04/22 15:32:19 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "node/default.hpp"
#include "webserv.hpp"
#include "cppeleven.hpp"
#include "node/ANode.hpp"
@ -33,8 +34,10 @@ Config::Config(std::string &filename) {
std::map<std::string, toml::ANode *> *node = table->getTable();
for (auto it = prange(node)) {
Server *srv = new Server(it->second);
_servers.push_back(srv);
if (it->second->type() == toml::TABLE) {
Server *srv = new Server(it->second);
_servers.push_back(srv);
}
}
delete table;
delete file;

View File

@ -6,18 +6,22 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/24 15:10:07 by adjoly #+# #+# */
/* Updated: 2025/04/22 14:26:00 by adjoly ### ########.fr */
/* Updated: 2025/04/22 15:25:06 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <webserv.hpp>
#include "cppeleven.hpp"
#include <config/default.hpp>
#include <webserv.hpp>
using namespace webserv::config;
Server::Server(toml::ANode *node) : _table(node) {
bool found;
if (_table == not_nullptr)
return;
// host parsing
void *host = accessValue("host", toml::STRING, _table, _log);
if (host != not_nullptr) {

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */
/* Updated: 2025/04/22 14:50:32 by adjoly ### ########.fr */
/* Updated: 2025/04/22 14:52:44 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 16:07:01 by mmoussou #+# #+# */
/* Updated: 2025/04/20 11:15:51 by mmoussou ### ########.fr */
/* Updated: 2025/04/22 15:03:46 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,6 +20,10 @@
using namespace webserv;
http::IRequest::~IRequest(void) {
}
std::string http::IRequest::str(void) const
{
std::ostringstream response;