add: file handling with 404

This commit is contained in:
Tobias Reisinger 2020-06-03 00:47:49 +02:00
parent 865caa627e
commit 20d38730c9
8 changed files with 157 additions and 83 deletions

7
main.c
View file

@ -51,6 +51,9 @@ main(int argc, const char** argv)
/******************** LOAD CONFIG ********************/
global_config.file = "core.ini";
global_config.not_found_file = "404.html";
global_config.not_found_content = "404 - NOT FOUND";
global_config.not_found_content_type = "text/plain";
global_config.log_level = LOG_LEVEL_INFO;
helper_parse_cli(argc, argv, &global_config);
@ -69,8 +72,10 @@ main(int argc, const char** argv)
fclose(ini_file);
memset(&global_config.http_server_opts, 0, sizeof(global_config.http_server_opts));
global_config.http_server_opts.document_root = "."; // Serve current directory
global_config.http_server_opts.enable_directory_listing = "yes";
global_config.http_server_opts.enable_directory_listing = "no";
global_config.http_server_opts.extra_headers = "Access-Control-Allow-Origin: *\r\nAccess-Control-Allow-Headers: *\r\nAccess-Control-Allow-Methods: *";
/******************** SETUP DATABASE ********************/