From 933c04882934fdc8633c93e706c8b28c977f776e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 1 Aug 2020 18:41:30 +0200 Subject: 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 } }) --- plugins/mod_http.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') 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 -- cgit v1.2.3