diff --git a/sample.toml b/sample.toml index f082b19..3f86598 100644 --- a/sample.toml +++ b/sample.toml @@ -1,5 +1,5 @@ [server] host = "0.0.0.0" -port = 80 +port = 8090 [server.location./] diff --git a/src/config/Route.cpp b/src/config/Route.cpp index 686bfcb..5716a49 100644 --- a/src/config/Route.cpp +++ b/src/config/Route.cpp @@ -60,7 +60,7 @@ Route::Route(toml::ANode *table) : _max_body(10485760) { void *val; bool found; - if (table == not_nullptr) { + if (table == not_nullptr || table->getTable()->empty()) { _log->warn("is empty"); _index = "index.html"; _redirect = false; @@ -93,6 +93,7 @@ Route::Route(toml::ANode *table) : _max_body(10485760) { _methods[2] = false; return; } + std::cout << "tat me re " << std::endl; val = accessValue("redirect", toml::STRING, _table, _log); if (val != not_nullptr) { _root = *static_cast(val); diff --git a/src/config/Server.cpp b/src/config/Server.cpp index 2b9c182..6df3b4c 100644 --- a/src/config/Server.cpp +++ b/src/config/Server.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/24 15:10:07 by adjoly #+# #+# */ -/* Updated: 2025/06/09 18:40:23 by adjoly ### ########.fr */ +/* Updated: 2025/06/17 19:14:04 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -87,6 +87,9 @@ Server::Server(toml::ANode *node) std::make_pair(URL(it->first), new Route(it->second))); } } + if (_routes == not_nullptr || _routes->empty()){ + throw std::runtime_error("put a location dumb ass"); + } // delete _table; } diff --git a/src/requests_handling/requestImplementation/Get.cpp b/src/requests_handling/requestImplementation/Get.cpp index 743b5ab..9cd477d 100644 --- a/src/requests_handling/requestImplementation/Get.cpp +++ b/src/requests_handling/requestImplementation/Get.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/30 09:40:16 by adjoly #+# #+# */ -/* Updated: 2025/05/30 16:39:08 by adjoly ### ########.fr */ +/* Updated: 2025/06/17 19:07:39 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/vgcore.37584 b/vgcore.37584 new file mode 100644 index 0000000..ffbe911 Binary files /dev/null and b/vgcore.37584 differ diff --git a/vgcore.38779 b/vgcore.38779 new file mode 100644 index 0000000..89e106e Binary files /dev/null and b/vgcore.38779 differ diff --git a/vgcore.39674 b/vgcore.39674 new file mode 100644 index 0000000..e1221d6 Binary files /dev/null and b/vgcore.39674 differ diff --git a/vgcore.40066 b/vgcore.40066 new file mode 100644 index 0000000..3753d86 Binary files /dev/null and b/vgcore.40066 differ diff --git a/vgcore.41056 b/vgcore.41056 new file mode 100644 index 0000000..e9e8df2 Binary files /dev/null and b/vgcore.41056 differ diff --git a/vgcore.41145 b/vgcore.41145 new file mode 100644 index 0000000..684e50f Binary files /dev/null and b/vgcore.41145 differ diff --git a/vgcore.41333 b/vgcore.41333 new file mode 100644 index 0000000..61a5589 Binary files /dev/null and b/vgcore.41333 differ