mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-05-10 18:08:46 +02:00
「🔨」 fix: fixed first segfault
This commit is contained in:
@ -6,13 +6,13 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/14 12:20:06 by adjoly #+# #+# */
|
/* Created: 2025/04/14 12:20:06 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 11:52:33 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/22 15:25:39 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <config/default.hpp>
|
#include <config/Server.hpp>
|
||||||
|
|
||||||
namespace webserv {
|
namespace webserv {
|
||||||
namespace config {
|
namespace config {
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/19 14:11:28 by adjoly #+# #+# */
|
/* Created: 2025/03/19 14:11:28 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 14:25:17 by adjoly ### ########.fr */
|
/* Updated: 2025/04/22 15:25:58 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <webserv.hpp>
|
#include <webserv.hpp>
|
||||||
#include <config/default.hpp>
|
#include <config/Route.hpp>
|
||||||
#include <cppeleven.hpp>
|
#include <cppeleven.hpp>
|
||||||
#include <node/ANode.hpp>
|
#include <node/ANode.hpp>
|
||||||
#include <webserv.hpp>
|
#include <webserv.hpp>
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/19 14:15:51 by adjoly #+# #+# */
|
/* Created: 2025/03/19 14:15:51 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/22 12:40:20 by adjoly ### ########.fr */
|
/* Updated: 2025/04/22 15:28:31 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <config/Config.hpp>
|
||||||
#include <config/Route.hpp>
|
#include <config/Route.hpp>
|
||||||
#include <config/Server.hpp>
|
#include <config/Server.hpp>
|
||||||
#include <config/Config.hpp>
|
|
||||||
#include <cppeleven.hpp>
|
#include <cppeleven.hpp>
|
||||||
#include <node/Table.hpp>
|
#include <node/Table.hpp>
|
||||||
#include <node/default.hpp>
|
#include <node/default.hpp>
|
||||||
@ -35,13 +35,13 @@ namespace config {
|
|||||||
* @return The value got or not_nullptr
|
* @return The value got or not_nullptr
|
||||||
*/
|
*/
|
||||||
static inline void *accessValue(const std::string &name, toml::nodeType type,
|
static inline void *accessValue(const std::string &name, toml::nodeType type,
|
||||||
toml::ANode *table, Logger *log) {
|
toml::ANode *table, Logger *log) {
|
||||||
void *val;
|
void *val;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (table == not_nullptr)
|
if (table == not_nullptr)
|
||||||
return not_nullptr;
|
return not_nullptr;
|
||||||
val = dynamic_cast<toml::Table *>(table)->access(name, type, found);
|
val = dynamic_cast<toml::ANode *>(table)->access(name, type, found);
|
||||||
if (found == true && val != not_nullptr) {
|
if (found == true && val != not_nullptr) {
|
||||||
return val;
|
return val;
|
||||||
} else {
|
} else {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/11 22:13:38 by mmoussou #+# #+# */
|
/* Created: 2025/02/11 22:13:38 by mmoussou #+# #+# */
|
||||||
/* Updated: 2025/04/22 11:52:05 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/22 15:00:18 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/03 17:23:00 by mmoussou #+# #+# */
|
/* Created: 2025/02/03 17:23:00 by mmoussou #+# #+# */
|
||||||
/* Updated: 2025/04/22 11:52:16 by mmoussou ### ########.fr */
|
/* Updated: 2025/04/22 15:07:02 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,10 +6,11 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */
|
/* 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 "webserv.hpp"
|
||||||
#include "cppeleven.hpp"
|
#include "cppeleven.hpp"
|
||||||
#include "node/ANode.hpp"
|
#include "node/ANode.hpp"
|
||||||
@ -33,8 +34,10 @@ Config::Config(std::string &filename) {
|
|||||||
|
|
||||||
std::map<std::string, toml::ANode *> *node = table->getTable();
|
std::map<std::string, toml::ANode *> *node = table->getTable();
|
||||||
for (auto it = prange(node)) {
|
for (auto it = prange(node)) {
|
||||||
Server *srv = new Server(it->second);
|
if (it->second->type() == toml::TABLE) {
|
||||||
_servers.push_back(srv);
|
Server *srv = new Server(it->second);
|
||||||
|
_servers.push_back(srv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delete table;
|
delete table;
|
||||||
delete file;
|
delete file;
|
||||||
|
@ -6,18 +6,22 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/24 15:10:07 by adjoly #+# #+# */
|
/* 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 <config/default.hpp>
|
||||||
|
#include <webserv.hpp>
|
||||||
|
|
||||||
using namespace webserv::config;
|
using namespace webserv::config;
|
||||||
|
|
||||||
Server::Server(toml::ANode *node) : _table(node) {
|
Server::Server(toml::ANode *node) : _table(node) {
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
|
if (_table == not_nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
// host parsing
|
// host parsing
|
||||||
void *host = accessValue("host", toml::STRING, _table, _log);
|
void *host = accessValue("host", toml::STRING, _table, _log);
|
||||||
if (host != not_nullptr) {
|
if (host != not_nullptr) {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/03 15:45:07 by mmoussou #+# #+# */
|
/* 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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/02/03 16:07:01 by mmoussou #+# #+# */
|
/* 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;
|
using namespace webserv;
|
||||||
|
|
||||||
|
http::IRequest::~IRequest(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
std::string http::IRequest::str(void) const
|
std::string http::IRequest::str(void) const
|
||||||
{
|
{
|
||||||
std::ostringstream response;
|
std::ostringstream response;
|
||||||
|
Reference in New Issue
Block a user