This commit is contained in:
Guillem George 2025-11-25 17:58:47 +01:00
parent 9d94c4d4e2
commit 2255bfc2e2

View file

@ -117,15 +117,15 @@ struct http_request *parse_request(struct string *req)
// TODO handle logs and free adequately // TODO handle logs and free adequately
struct http_response *generate_response(struct http_request *req) struct http_response *generate_response(struct http_request *req)
{ {
// Path
// Check filename // Check filename
if (!check_filename(req->path)) if (!check_filename(req->path))
return NULL; return NULL;
int err = is_directory(req->path->data); int err = is_directory(req->path->data);
if (err == -1) if (err == -1)
return NULL; return NULL;
else if (err == 1)
if (err == 1)
{ {
string_concat_str(req->path, "/", 1); string_concat_str(req->path, "/", 1);
string_concat_str(req->path, config->servers->default_file, string_concat_str(req->path, config->servers->default_file,