aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-08-01 18:41:23 +0200
committerKim Alvefur <zash@zash.se>2020-08-01 18:41:23 +0200
commit91d2ab91086d2aebcbc4d47a5bce05c6cd3abdcb (patch)
tree792a543eb0ec61821a6c9d439fca75dfed685c4f /plugins/mod_http.lua
parent64aa6a2a0e704221821cb53ccd90e19fabfa475e (diff)
downloadprosody-91d2ab91086d2aebcbc4d47a5bce05c6cd3abdcb.tar.gz
prosody-91d2ab91086d2aebcbc4d47a5bce05c6cd3abdcb.zip
net.http.parser: Allow specifying sink for large request bodies
This enables uses such as saving uploaded files directly to a file on disk or streaming parsing of payloads. See #726
Diffstat (limited to 'plugins/mod_http.lua')
-rw-r--r--plugins/mod_http.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index cf63ecfb..54c6089b 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -160,6 +160,15 @@ 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
+ -- COMPAT Modules not compatible with streaming uploads behave as before.
+ local _handler = handler;
+ function handler(event) -- luacheck: ignore 432/event
+ if event.request.body ~= false then
+ return _handler(event);
+ end
+ end
+ end
if not app_handlers[event_name] then
app_handlers[event_name] = {
main = handler;