Wip chunked decoding

+ Need to test normal body parsing
+ path_is_valid() renamed eval_file_type()
+ replaced atoi with strtol/strtoul
This commit is contained in:
LuckyLaszlo
2022-08-12 05:50:00 +02:00
parent ab0bc2c4c0
commit 400efbe720
18 changed files with 185 additions and 82 deletions

View File

@@ -231,7 +231,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
{
if (!::isNumeric(tmp_val[0]))
throw std::invalid_argument("client_body_limit not a number");
server->client_body_limit = atoi(tmp_val[0].c_str());
server->client_body_limit = std::strtoul(tmp_val[0].c_str(), NULL, 10);
}
else if (key == "index")
{
@@ -245,7 +245,7 @@ void ConfigParser::_set_server_values(ServerConfig *server, \
{
if (!(isNumeric_btw(400, 599, tmp_val[i])))
throw std::invalid_argument("invalid error code");
int status_code = atoi(tmp_val[i].c_str());
int status_code = std::strtoul(tmp_val[i].c_str(), NULL, 10);
if (server->error_pages.find(status_code) != server->error_pages.end())
throw std::invalid_argument("redeclaring error page");
server->error_pages[status_code] = path;
@@ -316,7 +316,7 @@ void ConfigParser::_set_location_values(LocationConfig *location, \
&& tmp_val[1].compare(0, 8, "https://"))
throw std::invalid_argument("bad redirect uri");
location->redirect_status = atoi(tmp_val[0].c_str());
location->redirect_status = std::strtoul(tmp_val[0].c_str(), NULL, 10);
location->redirect_uri = tmp_val[1];
}
else if (key == "upload_dir" && size == 1 && location->upload_dir == "")