Changeset

11022:3e5bc34be734

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 } })
author Kim Alvefur <zash@zash.se>
date Sat, 01 Aug 2020 18:41:30 +0200
parents 11021:9673c95895fb
children 11023:a59b37b03eca
files plugins/mod_http.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_http.lua	Sat Aug 01 18:41:23 2020 +0200
+++ b/plugins/mod_http.lua	Sat Aug 01 18:41:30 2020 +0200
@@ -138,6 +138,8 @@
 			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 @@
 				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