diff --git a/includes/config/Server.hpp b/includes/config/Server.hpp index c701c5e..ab4a6f7 100644 --- a/includes/config/Server.hpp +++ b/includes/config/Server.hpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/19 14:11:28 by adjoly #+# #+# */ -/* Updated: 2025/05/03 09:42:27 by adjoly ### ########.fr */ +/* Updated: 2025/06/23 20:10:48 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,6 +35,8 @@ class Server { * @param The http error code for the page */ std::string getErrorPage(int page) { + if (_err_pages == not_nullptr) + return ""; if (_err_pages->find(page) != _err_pages->end()) return (*_err_pages)[page]; else diff --git a/lib/tomlpp b/lib/tomlpp index 9926aa1..9f3aa94 160000 --- a/lib/tomlpp +++ b/lib/tomlpp @@ -1 +1 @@ -Subproject commit 9926aa1530c08923d092df755fd5c876e56a409c +Subproject commit 9f3aa94aeb7fbe54518d7431c5ec35e66ecc7741 diff --git a/sample.toml b/sample.toml index 3f86598..933dad8 100644 --- a/sample.toml +++ b/sample.toml @@ -3,3 +3,4 @@ host = "0.0.0.0" port = 8090 [server.location./] +methods = {"GET" diff --git a/src/config/Config.cpp b/src/config/Config.cpp index 9555a37..3654b97 100644 --- a/src/config/Config.cpp +++ b/src/config/Config.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */ -/* Updated: 2025/05/03 09:42:44 by adjoly ### ########.fr */ +/* Updated: 2025/06/23 20:36:47 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,6 +16,7 @@ #include "node/default.hpp" #include "webserv.hpp" #include +#include #include #include @@ -26,7 +27,9 @@ Config::Config(std::string &filename) { try { file->parse(); - } catch (std::runtime_error &e) { + } catch (std::exception &e) { + // if (file->getParsedFile() != not_nullptr) + // delete file->getParsedFile(); delete file; throw e; } diff --git a/src/main.cpp b/src/main.cpp index 59d9027..2361b93 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,7 @@ /* By: mmoussou