is_cgi function is back and is working
+ in utils added function eval_file_mode(), it returns http errors codes about file
This commit is contained in:
@@ -171,6 +171,21 @@ file_type eval_file_type(const std::string &path)
|
||||
return (IS_OTHER);
|
||||
}
|
||||
|
||||
size_t eval_file_mode(std::string path, int mode)
|
||||
{
|
||||
if (access(path.c_str(), F_OK) == -1)
|
||||
{
|
||||
std::perror("err access()");
|
||||
return 404; // NOT_FOUND, file doesn't exist
|
||||
}
|
||||
|
||||
if (access(path.c_str(), mode) == -1)
|
||||
{
|
||||
std::perror("err access()");
|
||||
return 403; // FORBIDDEN, file doesn't have execution permission
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
replace_all_substr(
|
||||
|
||||
Reference in New Issue
Block a user