diff options
author | Kim Alvefur <zash@zash.se> | 2020-08-01 18:41:23 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-08-01 18:41:23 +0200 |
commit | eefe8a76880872993d0f65f600830b91caabbe23 (patch) | |
tree | 792a543eb0ec61821a6c9d439fca75dfed685c4f /plugins | |
parent | 55a5af04f19344a497dcf17e3a762e9b7da72d29 (diff) | |
download | prosody-eefe8a76880872993d0f65f600830b91caabbe23.tar.gz prosody-eefe8a76880872993d0f65f600830b91caabbe23.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')
-rw-r--r-- | plugins/mod_http.lua | 9 |
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; |