# HG changeset patch # User Kim Alvefur # Date 1355260495 -3600 # Node ID c9bb5879e1933430e1e2fd63011fc623f1ffc8ff # Parent 6f5640375358a972d3da3101b5bfd9b6371b5468 mod_http_files: Configurable number of index files to check for diff -r 6f5640375358 -r c9bb5879e193 plugins/mod_http_files.lua --- a/plugins/mod_http_files.lua Sun Dec 09 12:20:55 2012 +0100 +++ b/plugins/mod_http_files.lua Tue Dec 11 22:14:55 2012 +0100 @@ -13,6 +13,7 @@ local stat = lfs.attributes; local http_base = module:get_option_string("http_files_dir", module:get_option_string("http_path", "www_files")); +local dir_indices = module:get_option("http_files_index", { "index.html", "index.htm" }); -- TODO: Should we read this from /etc/mime.types if it exists? (startup time...?) local mime_map = { @@ -34,8 +35,10 @@ response.headers.location = orig_path.."/"; return 301; end - if stat(full_path.."index.html", "mode") == "file" then - return serve_file(event, path.."index.html"); + for i=1,#dir_indices do + if stat(full_path..dir_indices[i], "mode") == "file" then + return serve_file(event, path..dir_indices[i]); + end end -- TODO File listing