mirror of
https://github.com/KeyZox71/webserv.git
synced 2025-06-25 09:33:36 +02:00
「🔨」 fix: fixed
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */
|
/* Created: 2025/03/19 14:59:41 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/05/28 09:52:21 by adjoly ### ########.fr */
|
/* Updated: 2025/06/09 18:35:35 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ std::vector<std::string> *Route::_parseCGI(toml::ANode *table) {
|
|||||||
if ((*it)->type() == toml::STRING) {
|
if ((*it)->type() == toml::STRING) {
|
||||||
std::string str = *static_cast<std::string *>((*it)->getValue());
|
std::string str = *static_cast<std::string *>((*it)->getValue());
|
||||||
cgi->push_back(str);
|
cgi->push_back(str);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
str << "Was expecting a: " << toml::nodeTypeToStr(toml::STRING);
|
str << "Was expecting a: " << toml::nodeTypeToStr(toml::STRING);
|
||||||
str << ", but got a: " << toml::nodeTypeToStr((*it)->type());
|
str << ", but got a: " << toml::nodeTypeToStr((*it)->type());
|
||||||
@ -61,10 +60,37 @@ Route::Route(toml::ANode *table) : _max_body(10485760) {
|
|||||||
void *val;
|
void *val;
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
|
if (table == not_nullptr) {
|
||||||
|
_log->warn("is empty");
|
||||||
|
_index = "index.html";
|
||||||
|
_redirect = false;
|
||||||
|
_dirlist = false;
|
||||||
|
_up_root = "";
|
||||||
|
#ifdef PKGS
|
||||||
|
_root = "/usr/share/webserv";
|
||||||
|
#else
|
||||||
|
_root = "./html";
|
||||||
|
#endif
|
||||||
|
_cgi = not_nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
_table = table;
|
_table = table;
|
||||||
if (_table->type() != toml::TABLE) {
|
if (_table->type() != toml::TABLE) {
|
||||||
_log->warn("location need to be a table and not a :" +
|
_log->warn("location need to be a table and not a :" +
|
||||||
toml::nodeTypeToStr(_table->type()));
|
toml::nodeTypeToStr(_table->type()));
|
||||||
|
_index = "index.html";
|
||||||
|
_redirect = false;
|
||||||
|
_dirlist = false;
|
||||||
|
_up_root = "";
|
||||||
|
#ifdef PKGS
|
||||||
|
_root = "/usr/share/webserv";
|
||||||
|
#else
|
||||||
|
_root = "./html";
|
||||||
|
#endif
|
||||||
|
_cgi = not_nullptr;
|
||||||
|
_methods[0] = true;
|
||||||
|
_methods[1] = false;
|
||||||
|
_methods[2] = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
val = accessValue("redirect", toml::STRING, _table, _log);
|
val = accessValue("redirect", toml::STRING, _table, _log);
|
||||||
@ -79,11 +105,6 @@ Route::Route(toml::ANode *table) : _max_body(10485760) {
|
|||||||
_dirlist = *static_cast<bool *>(val);
|
_dirlist = *static_cast<bool *>(val);
|
||||||
else
|
else
|
||||||
_dirlist = false;
|
_dirlist = false;
|
||||||
/* val = accessValue("cookies", toml::BOOL, _table, _log); */
|
|
||||||
/* if (val != not_nullptr) */
|
|
||||||
/* _cookies = *static_cast<bool *>(val); */
|
|
||||||
/* else */
|
|
||||||
/* _cookies = false; */
|
|
||||||
val = accessValue("upload_path", toml::STRING, _table, _log);
|
val = accessValue("upload_path", toml::STRING, _table, _log);
|
||||||
if (val != not_nullptr)
|
if (val != not_nullptr)
|
||||||
_up_root = *static_cast<std::string *>(val);
|
_up_root = *static_cast<std::string *>(val);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* 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/05/28 11:42:25 by adjoly ### ########.fr */
|
/* Updated: 2025/06/09 18:40:23 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -196,5 +196,7 @@ Server::Server(toml::ANode *node, void *)
|
|||||||
std::make_pair(URL(it->first), new Route(it->second)));
|
std::make_pair(URL(it->first), new Route(it->second)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
_routes = not_nullptr;
|
||||||
// delete _table;
|
// delete _table;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user