aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-08-01 18:41:30 +0200
committerKim Alvefur <zash@zash.se>2020-08-01 18:41:30 +0200
commit933c04882934fdc8633c93e706c8b28c977f776e (patch)
tree9aae09199af4f2ade66a55c9904b9f9510c13e95 /plugins/mod_http.lua
parent91d2ab91086d2aebcbc4d47a5bce05c6cd3abdcb (diff)
downloadprosody-933c04882934fdc8633c93e706c8b28c977f776e.tar.gz
prosody-933c04882934fdc8633c93e706c8b28c977f776e.zip
mod_http: Add way to signal that a module supports streaming uploads
Fixes #726 API: module:provides("http", { streaming_uploads = true; route = { PUT = function (event) event.request.body_sink = io.tmpfile(); return true; end } })
Diffstat (limited to 'plugins/mod_http.lua')
-rw-r--r--plugins/mod_http.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index 54c6089b..1248a06c 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -138,6 +138,8 @@ function module.add_host(module)
return "";
end
+ local streaming = event.item.streaming_uploads;
+
for key, handler in pairs(event.item.route or {}) do
local event_name = get_http_event(host, app_path, key);
if event_name then
@@ -160,7 +162,7 @@ function module.add_host(module)
elseif event_name:sub(-1, -1) == "/" then
module:hook_object_event(server, event_name:sub(1, -2), redir_handler, -1);
end
- do
+ if not streaming then
-- COMPAT Modules not compatible with streaming uploads behave as before.
local _handler = handler;
function handler(event) -- luacheck: ignore 432/event