Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
11020:7076ed654ac9 | 11021:9673c95895fb |
---|---|
157 return _handler(_event, path); | 157 return _handler(_event, path); |
158 end; | 158 end; |
159 module:hook_object_event(server, event_name:sub(1, -3), redir_handler, -1); | 159 module:hook_object_event(server, event_name:sub(1, -3), redir_handler, -1); |
160 elseif event_name:sub(-1, -1) == "/" then | 160 elseif event_name:sub(-1, -1) == "/" then |
161 module:hook_object_event(server, event_name:sub(1, -2), redir_handler, -1); | 161 module:hook_object_event(server, event_name:sub(1, -2), redir_handler, -1); |
162 end | |
163 do | |
164 -- COMPAT Modules not compatible with streaming uploads behave as before. | |
165 local _handler = handler; | |
166 function handler(event) -- luacheck: ignore 432/event | |
167 if event.request.body ~= false then | |
168 return _handler(event); | |
169 end | |
170 end | |
162 end | 171 end |
163 if not app_handlers[event_name] then | 172 if not app_handlers[event_name] then |
164 app_handlers[event_name] = { | 173 app_handlers[event_name] = { |
165 main = handler; | 174 main = handler; |
166 cors = cors_handler; | 175 cors = cors_handler; |