Software /
code /
prosody
Diff
plugins/mod_http.lua @ 11021:9673c95895fb
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
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 01 Aug 2020 18:41:23 +0200 |
parent | 10923:dff1aebd0f2b |
child | 11022:3e5bc34be734 |
line wrap: on
line diff
--- a/plugins/mod_http.lua Sat Aug 01 18:14:09 2020 +0200 +++ b/plugins/mod_http.lua Sat Aug 01 18:41:23 2020 +0200 @@ -160,6 +160,15 @@ 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;