fixed error in is_cgi, path was missing dot
This commit is contained in:
@@ -3,9 +3,10 @@
|
|||||||
|
|
||||||
bool Webserv::_is_cgi(Client *client, std::string path)
|
bool Webserv::_is_cgi(Client *client, std::string path)
|
||||||
{
|
{
|
||||||
size_t file_type;
|
std::string script_path;
|
||||||
size_t file_mode;
|
size_t file_type;
|
||||||
size_t pos = 0;
|
size_t file_mode;
|
||||||
|
size_t pos = 0;
|
||||||
|
|
||||||
while (pos != NPOS)
|
while (pos != NPOS)
|
||||||
{
|
{
|
||||||
@@ -14,17 +15,19 @@ bool Webserv::_is_cgi(Client *client, std::string path)
|
|||||||
if (pos == NPOS)
|
if (pos == NPOS)
|
||||||
break;
|
break;
|
||||||
client->fill_script_path(path, pos);
|
client->fill_script_path(path, pos);
|
||||||
file_type = ::eval_file_type(client->get_rq_script_path());
|
script_path = "." + client->get_rq_script_path();
|
||||||
|
file_type = ::eval_file_type(script_path);
|
||||||
if (file_type == IS_DIR) // but what if it's a symlink ?
|
if (file_type == IS_DIR) // but what if it's a symlink ?
|
||||||
continue;
|
continue;
|
||||||
if (file_type == IS_FILE)
|
if (file_type == IS_FILE)
|
||||||
{
|
{
|
||||||
file_mode = ::eval_file_mode( client->get_rq_script_path(), X_OK );
|
file_mode = ::eval_file_mode( script_path, X_OK );
|
||||||
if (!file_mode)
|
if (!file_mode)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client->clear_script();
|
client->clear_script();
|
||||||
|
client->clear_script();
|
||||||
client->status = file_mode; // 404 not_found OR 403 forbidden
|
client->status = file_mode; // 404 not_found OR 403 forbidden
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user