diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-11 22:14:55 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-11 22:14:55 +0100 |
commit | d623c4a3e2f1da496fbad6c73ad6ce1a0e0a3979 (patch) | |
tree | 3b67897ceb09c182cc21d9575962402f8cd4b299 /plugins/mod_http_files.lua | |
parent | 3904cf00a1c09dad9b1938e031b6ebf4f39be5f7 (diff) | |
download | prosody-d623c4a3e2f1da496fbad6c73ad6ce1a0e0a3979.tar.gz prosody-d623c4a3e2f1da496fbad6c73ad6ce1a0e0a3979.zip |
mod_http_files: Configurable number of index files to check for
Diffstat (limited to 'plugins/mod_http_files.lua')
-rw-r--r-- | plugins/mod_http_files.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index bdc3a011..62cb39b2 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -13,6 +13,7 @@ local open = io.open; 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 @@ function serve_file(event, path) 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 |