diff --git a/srcs/ConfigParser.cpp b/srcs/ConfigParser.cpp index 30f3014..20a8e3a 100644 --- a/srcs/ConfigParser.cpp +++ b/srcs/ConfigParser.cpp @@ -240,7 +240,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \ else { std::vector tmp2 = ::split(tmp_val[0], ':'); - if (!(isNumeric(tmp2[1]))) + if (!(::isNumeric(tmp2[1]))) throw std::invalid_argument("value not a number"); // not sure if this is what we want, means there's only 1 host per @@ -262,7 +262,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \ else if (key == "client_body_limit" && size == 1) { //std::cout << "made it\n"; - if (!(isNumeric(tmp_val[0]))) + if (!(::isNumeric(tmp_val[0]))) throw std::invalid_argument("value not a number"); server->client_body_limit = atoi(tmp_val[0].c_str()); } @@ -299,7 +299,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \ if (tmp_val.size() != 2) throw std::invalid_argument("wrong number of values"); // and tmp_val[0] should be a number and tmp_val[1] a string? - if (!(isNumeric(tmp_val[0]))) + if (!(::isNumeric(tmp_val[0]))) throw std::invalid_argument("value not a number"); // something about using access() to see if diff --git a/srcs/ConfigParser.hpp b/srcs/ConfigParser.hpp index eeaa93d..029080d 100644 --- a/srcs/ConfigParser.hpp +++ b/srcs/ConfigParser.hpp @@ -13,26 +13,19 @@ #ifndef CONFIGPARSER_HPP # define CONFIGPARSER_HPP -# include "Webserv.hpp" // easier to just do this? # include "ServerConfig.hpp" -// add includes properly +# include "LocationConfig.hpp" +# include "MethodType.hpp" +# include "utils.hpp" - -// This is gonna be temporary cuz i don't konw if i like it -#define MAX_REQUEST_SIZE 2048 -#define MAX_URI_SIZE 64 -#define BSIZE 1024 - -/* -// this can't be here... -enum MethodType -{ - GET, - POST, - DELETE, - INVALID, -}; -*/ +# include +# include +# include // exception, what +# include // runtime_error, invalid_argument +# include // string +# include // atoi (athough it's already cover by ) +# include // cout, cin +# include // ifstream class ConfigParser { @@ -84,7 +77,6 @@ private: // why static? it's an enum... static MethodType _str_to_method_type(std::string str); - // just for testing purposes }; diff --git a/srcs/ConfigParserUtils.cpp b/srcs/ConfigParserUtils.cpp index 6947a4c..558de5e 100644 --- a/srcs/ConfigParserUtils.cpp +++ b/srcs/ConfigParserUtils.cpp @@ -1,7 +1,7 @@ -#include "Webserv.hpp" +#include "ConfigParser.hpp" diff --git a/srcs/LocationConfig.hpp b/srcs/LocationConfig.hpp index 72ab187..ea17c1c 100644 --- a/srcs/LocationConfig.hpp +++ b/srcs/LocationConfig.hpp @@ -13,12 +13,12 @@ #ifndef LOCATIONCONFIG_HPP # define LOCATIONCONFIG_HPP -// includes - // add includes properly -# include -# include +# include "MethodType.hpp" + # include -# include "Webserv.hpp" +# include +# include + // again, struct instead? class LocationConfig @@ -38,8 +38,6 @@ public: }; - - #endif diff --git a/srcs/ServerConfig.hpp b/srcs/ServerConfig.hpp index a020d9d..bafe431 100644 --- a/srcs/ServerConfig.hpp +++ b/srcs/ServerConfig.hpp @@ -13,12 +13,14 @@ #ifndef SERVERCONFIG_HPP # define SERVERCONFIG_HPP -// add includes properly... -# include "Webserv.hpp" # include "MethodType.hpp" -//# include "ConfigParser.hpp" # include "LocationConfig.hpp" +# include +# include +# include // string +# include // cout, cin + // a class that's all public? just so we have options? class ServerConfig { diff --git a/srcs/Webserv.hpp b/srcs/Webserv.hpp index b5a7b8b..0c60194 100644 --- a/srcs/Webserv.hpp +++ b/srcs/Webserv.hpp @@ -27,12 +27,13 @@ # include "Client.hpp" # include "ServerConfig.hpp" +# include "utils.hpp" // TODO: A virer -# include "ConfigParser.hpp" -# include "LocationConfig.hpp" -# include "MethodType.hpp" -# include "utils.hpp" +//# include "ConfigParser.hpp" +//# include "LocationConfig.hpp" +//# include "MethodType.hpp" +//# include "utils.hpp" // TODO: A virer extern bool g_run; diff --git a/srcs/main.cpp b/srcs/main.cpp index 4c580f3..fbe96e3 100644 --- a/srcs/main.cpp +++ b/srcs/main.cpp @@ -3,6 +3,7 @@ #include #include #include "Webserv.hpp" +#include "ConfigParser.hpp" int main(int ac, char **av) { diff --git a/srcs/utils.hpp b/srcs/utils.hpp index 1730236..64ca8f3 100644 --- a/srcs/utils.hpp +++ b/srcs/utils.hpp @@ -5,10 +5,11 @@ # include # include # include +# include // atoi (athough it's already cover by ) -std::vector split(std::string input, char delimiter); -bool isNumeric(std::string str); -bool isNumeric_btw(int low, int high, std::string str); -char* itoa(int n); +std::vector split(std::string input, char delimiter); +bool isNumeric(std::string str); +bool isNumeric_btw(int low, int high, std::string str); +char* itoa(int n); #endif