Fixed the includes
This commit is contained in:
@@ -240,7 +240,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<std::string> tmp2 = ::split(tmp_val[0], ':');
|
std::vector<std::string> tmp2 = ::split(tmp_val[0], ':');
|
||||||
if (!(isNumeric(tmp2[1])))
|
if (!(::isNumeric(tmp2[1])))
|
||||||
throw std::invalid_argument("value not a number");
|
throw std::invalid_argument("value not a number");
|
||||||
|
|
||||||
// not sure if this is what we want, means there's only 1 host per
|
// 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)
|
else if (key == "client_body_limit" && size == 1)
|
||||||
{
|
{
|
||||||
//std::cout << "made it\n";
|
//std::cout << "made it\n";
|
||||||
if (!(isNumeric(tmp_val[0])))
|
if (!(::isNumeric(tmp_val[0])))
|
||||||
throw std::invalid_argument("value not a number");
|
throw std::invalid_argument("value not a number");
|
||||||
server->client_body_limit = atoi(tmp_val[0].c_str());
|
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)
|
if (tmp_val.size() != 2)
|
||||||
throw std::invalid_argument("wrong number of values");
|
throw std::invalid_argument("wrong number of values");
|
||||||
// and tmp_val[0] should be a number and tmp_val[1] a string?
|
// 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");
|
throw std::invalid_argument("value not a number");
|
||||||
|
|
||||||
// something about using access() to see if
|
// something about using access() to see if
|
||||||
|
|||||||
@@ -13,26 +13,19 @@
|
|||||||
#ifndef CONFIGPARSER_HPP
|
#ifndef CONFIGPARSER_HPP
|
||||||
# define CONFIGPARSER_HPP
|
# define CONFIGPARSER_HPP
|
||||||
|
|
||||||
# include "Webserv.hpp" // easier to just do this?
|
|
||||||
# include "ServerConfig.hpp"
|
# include "ServerConfig.hpp"
|
||||||
// add includes properly
|
# include "LocationConfig.hpp"
|
||||||
|
# include "MethodType.hpp"
|
||||||
|
# include "utils.hpp"
|
||||||
|
|
||||||
|
# include <map>
|
||||||
// This is gonna be temporary cuz i don't konw if i like it
|
# include <vector>
|
||||||
#define MAX_REQUEST_SIZE 2048
|
# include <exception> // exception, what
|
||||||
#define MAX_URI_SIZE 64
|
# include <stdexcept> // runtime_error, invalid_argument
|
||||||
#define BSIZE 1024
|
# include <string> // string
|
||||||
|
# include <cstdlib> // atoi (athough it's already cover by <string>)
|
||||||
/*
|
# include <iostream> // cout, cin
|
||||||
// this can't be here...
|
# include <fstream> // ifstream
|
||||||
enum MethodType
|
|
||||||
{
|
|
||||||
GET,
|
|
||||||
POST,
|
|
||||||
DELETE,
|
|
||||||
INVALID,
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigParser {
|
class ConfigParser {
|
||||||
@@ -84,7 +77,6 @@ private:
|
|||||||
// why static? it's an enum...
|
// why static? it's an enum...
|
||||||
static MethodType _str_to_method_type(std::string str);
|
static MethodType _str_to_method_type(std::string str);
|
||||||
|
|
||||||
// just for testing purposes
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "Webserv.hpp"
|
#include "ConfigParser.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,12 @@
|
|||||||
#ifndef LOCATIONCONFIG_HPP
|
#ifndef LOCATIONCONFIG_HPP
|
||||||
# define LOCATIONCONFIG_HPP
|
# define LOCATIONCONFIG_HPP
|
||||||
|
|
||||||
// includes
|
# include "MethodType.hpp"
|
||||||
// add includes properly
|
|
||||||
# include <string>
|
|
||||||
# include <vector>
|
|
||||||
# include <map>
|
# include <map>
|
||||||
# include "Webserv.hpp"
|
# include <vector>
|
||||||
|
# include <string>
|
||||||
|
|
||||||
|
|
||||||
// again, struct instead?
|
// again, struct instead?
|
||||||
class LocationConfig
|
class LocationConfig
|
||||||
@@ -38,8 +38,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,14 @@
|
|||||||
#ifndef SERVERCONFIG_HPP
|
#ifndef SERVERCONFIG_HPP
|
||||||
# define SERVERCONFIG_HPP
|
# define SERVERCONFIG_HPP
|
||||||
|
|
||||||
// add includes properly...
|
|
||||||
# include "Webserv.hpp"
|
|
||||||
# include "MethodType.hpp"
|
# include "MethodType.hpp"
|
||||||
//# include "ConfigParser.hpp"
|
|
||||||
# include "LocationConfig.hpp"
|
# include "LocationConfig.hpp"
|
||||||
|
|
||||||
|
# include <map>
|
||||||
|
# include <vector>
|
||||||
|
# include <string> // string
|
||||||
|
# include <iostream> // cout, cin
|
||||||
|
|
||||||
// a class that's all public? just so we have options?
|
// a class that's all public? just so we have options?
|
||||||
class ServerConfig
|
class ServerConfig
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,12 +27,13 @@
|
|||||||
|
|
||||||
# include "Client.hpp"
|
# include "Client.hpp"
|
||||||
# include "ServerConfig.hpp"
|
# include "ServerConfig.hpp"
|
||||||
|
# include "utils.hpp"
|
||||||
|
|
||||||
// TODO: A virer
|
// TODO: A virer
|
||||||
# include "ConfigParser.hpp"
|
//# include "ConfigParser.hpp"
|
||||||
# include "LocationConfig.hpp"
|
//# include "LocationConfig.hpp"
|
||||||
# include "MethodType.hpp"
|
//# include "MethodType.hpp"
|
||||||
# include "utils.hpp"
|
//# include "utils.hpp"
|
||||||
// TODO: A virer
|
// TODO: A virer
|
||||||
|
|
||||||
extern bool g_run;
|
extern bool g_run;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "Webserv.hpp"
|
#include "Webserv.hpp"
|
||||||
|
#include "ConfigParser.hpp"
|
||||||
|
|
||||||
int main(int ac, char **av)
|
int main(int ac, char **av)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
# include <vector>
|
# include <vector>
|
||||||
# include <string>
|
# include <string>
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
|
# include <cstdlib> // atoi (athough it's already cover by <string>)
|
||||||
|
|
||||||
std::vector<std::string> split(std::string input, char delimiter);
|
std::vector<std::string> split(std::string input, char delimiter);
|
||||||
bool isNumeric(std::string str);
|
bool isNumeric(std::string str);
|
||||||
|
|||||||
Reference in New Issue
Block a user