diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-21 20:34:40 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-21 20:34:40 +0100 |
commit | 0865e342682e3a9980822c9a9233f63a067a4e33 (patch) | |
tree | 8b19eb42fd70109690078b04f7d104e73613adac /plugins/mod_http_files.lua | |
parent | 88d386b8dd9b29bd2ec20544d515dac5b2e39442 (diff) | |
download | prosody-0865e342682e3a9980822c9a9233f63a067a4e33.tar.gz prosody-0865e342682e3a9980822c9a9233f63a067a4e33.zip |
mod_http_files: Work with non-wildcard-routes. Key cache on the original HTTP path.
Diffstat (limited to 'plugins/mod_http_files.lua')
-rw-r--r-- | plugins/mod_http_files.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index bd39936d..311b3a4b 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -78,11 +78,11 @@ function serve(opts) return 304; end - local data = cache[path]; + local data = cache[orig_path]; if data and data.etag == etag then response_headers.content_type = data.content_type; data = data.data; - elseif attr.mode == "directory" then + elseif attr.mode == "directory" and path then if full_path:sub(-1) ~= "/" then local path = { is_absolute = true, is_directory = true }; for dir in orig_path:gmatch("[^/]+") do path[#path+1]=dir; end @@ -101,7 +101,7 @@ function serve(opts) if not data then return 403; end - cache[path] = { data = data, content_type = mime_map.html; etag = etag; }; + cache[orig_path] = { data = data, content_type = mime_map.html; etag = etag; }; response_headers.content_type = mime_map.html; else @@ -114,9 +114,9 @@ function serve(opts) module:log("debug", "Could not open or read %s. Error was %s", full_path, err); return 403; end - local ext = path:match("%.([^./]+)$"); + local ext = orig_path:match("%.([^./]+)$"); local content_type = ext and mime_map[ext]; - cache[path] = { data = data; content_type = content_type; etag = etag }; + cache[orig_path] = { data = data; content_type = content_type; etag = etag }; response_headers.content_type = content_type; end |