mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-29 05:17:59 +03:00
fix: segv
This commit is contained in:
@@ -135,7 +135,11 @@ location *Config::getLocation(std::vector<location *> &arr, std::string &URI)
|
||||
{
|
||||
tmp = *it;
|
||||
if (tmp->location == "/")
|
||||
{
|
||||
tmp = new location;
|
||||
copyLocation(tmp, *it);
|
||||
return (tmp);
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
||||
|
||||
@@ -228,6 +228,8 @@ std::string Response::getFullURI(void)
|
||||
else
|
||||
ret = tmp;
|
||||
|
||||
DBOUT << PINK << "location " << _location->location << ENDL;
|
||||
DBOUT << PINK << "fullURI " << ret << ENDL;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -415,14 +417,6 @@ void Response::methodPost(void)
|
||||
_body.erase(_body.begin(), _body.begin() + pos + 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ofstream outfile(_fullURI.c_str(), std::ios::out | std::ios::binary);
|
||||
|
||||
outfile.write(_request.getBody().data(), _request.getBody().size());
|
||||
outfile.close();
|
||||
_code = 204;
|
||||
}
|
||||
setHeaderBlocks();
|
||||
generateHeader();
|
||||
DBOUT << GREEN << "POST method called" << ENDL;
|
||||
|
||||
Reference in New Issue
Block a user