diff options
author | Kim Alvefur <zash@zash.se> | 2019-04-05 18:18:23 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-04-05 18:18:23 +0200 |
commit | 9163493840c796d31feabdf3d3d379442e3a7020 (patch) | |
tree | 41e622029de879a6276204f0b7477190487d9774 | |
parent | 568fc99fea90769ea7ddac77cbf1028ca3c332d2 (diff) | |
download | prosody-9163493840c796d31feabdf3d3d379442e3a7020.tar.gz prosody-9163493840c796d31feabdf3d3d379442e3a7020.zip |
mod_http_files: Try to determine which module using serve() needs updating
-rw-r--r-- | plugins/mod_http_files.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index acb99501..c357ddfc 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -46,6 +46,12 @@ if not mime_map then end end +local function get_calling_module() + local info = debug.getinfo(3, "S"); + if not info then return "An unknown module"; end + return info.source:match"mod_[^/\\.]+" or info.short_src; +end + -- COMPAT -- TODO deprecate function serve(opts) if type(opts) ~= "table" then -- assume path string @@ -67,12 +73,12 @@ function serve(opts) opts.index_files = dir_indices; end -- TODO Crank up to warning - module:log("debug", "Use of mod_http_files.serve() should be updated to use net.http.files"); + module:log("debug", "%s should be updated to use 'net.http.files' insead of mod_http_files", get_calling_module()); return fileserver.serve(opts); end function wrap_route(routes) - module:log("debug", "Use of mod_http_files.wrap_route() should be updated to use net.http.files"); + module:log("debug", "%s should be updated to use 'net.http.files' insead of mod_http_files", get_calling_module()); for route,handler in pairs(routes) do if type(handler) ~= "function" then routes[route] = fileserver.serve(handler); |