diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-05-12 03:36:15 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-05-12 03:36:15 +0100 |
commit | 607a60086c53d60d9682e45a82f34099112e6ab9 (patch) | |
tree | 2c8b9cfd14e673bd7bd3af2046abe1edea3cdb61 | |
parent | daed96bd73818870315c9d5d63bb200a127dd9ee (diff) | |
parent | 09626bd72a67939e1770460f92fdfcacac76ccb2 (diff) | |
download | prosody-607a60086c53d60d9682e45a82f34099112e6ab9.tar.gz prosody-607a60086c53d60d9682e45a82f34099112e6ab9.zip |
Merge with Zash
-rw-r--r-- | plugins/mod_http_files.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index dc58ff5d..bdc3a011 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -27,11 +27,18 @@ local mime_map = { function serve_file(event, path) local response = event.response; + local orig_path = event.request.path; local full_path = http_base.."/"..path; if stat(full_path, "mode") == "directory" then - if stat(full_path.."/index.html", "mode") == "file" then - return serve_file(event, path.."/index.html"); + if full_path:sub(-1) ~= "/" then + response.headers.location = orig_path.."/"; + return 301; end + if stat(full_path.."index.html", "mode") == "file" then + return serve_file(event, path.."index.html"); + end + + -- TODO File listing return 403; end local f, err = open(full_path, "rb"); |