added script download test
This commit is contained in:
@@ -147,11 +147,7 @@ std::string get_value(const std::string & key, const std::string & rq_body)
|
||||
}
|
||||
|
||||
void
|
||||
fill_response_basic(
|
||||
char **env,
|
||||
std::string & http_body,
|
||||
std::string & http_header,
|
||||
const std::string & rq_body)
|
||||
fill_body_basic(char **env, std::string & http_body, const std::string & rq_body)
|
||||
{
|
||||
std::string rq_method = "not found";
|
||||
std::string rq_query;
|
||||
@@ -183,7 +179,21 @@ void
|
||||
http_body += print_env(env, "p");
|
||||
|
||||
http_body += HTML_BODY_BOTTOM;
|
||||
|
||||
http_header = "Content-Type: text/html; charset=UTF-8" CRLF;
|
||||
}
|
||||
|
||||
size_t eval_file_read(const std::string &path)
|
||||
{
|
||||
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(), R_OK) == -1)
|
||||
{
|
||||
std::perror("err access()");
|
||||
return 403; // FORBIDDEN, file doesn't have access permission
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user