lots of log message and fixed bad_file_descriptor issue

This commit is contained in:
hugogogo
2022-08-22 01:50:28 +02:00
parent 469eca8aa9
commit 5225e3258b
18 changed files with 186 additions and 112 deletions

View File

@@ -7,7 +7,7 @@
*/
void Webserv::_get(Client *client, std::string &path)
{
std::cout << "_get()\n";
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") _get()\n"; // debug
if (eval_file_type(path) == IS_DIR)
{
if (path[path.size() - 1] != '/')
@@ -18,7 +18,7 @@ void Webserv::_get(Client *client, std::string &path)
{
path.append(client->assigned_location->index[i]);
_get_file(client, path);
std::cerr << "Added an index\n"; //debug
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") Added an index\n"; //debug
return ;
}
}
@@ -41,8 +41,7 @@ void Webserv::_get_file(Client *client, const std::string &path)
std::ifstream ifd; // For chunk, ifstream directly in struct CLient for multiples read without close() ?
std::stringstream buf;
std::cout << "_get_file()\n";
std::cerr << family << "| (" << std::setw(2) << client->get_cl_fd() << ") _get_file()\n";
client->status = ::eval_file_access(path, R_OK);
if (client->status)
return;
@@ -90,7 +89,7 @@ if (size > MAX_FILESIZE)
*/
void Webserv::_autoindex(Client *client, const std::string &path)
{
std::cout << "_autoindex()\n";
std::cerr << "_autoindex()\n";
std::string dir_list;
DIR *dir;