Comparison

mod_http_upload/mod_http_upload.lua @ 2667:0c7802b95820

mod_http_upload: Fix halting of event propagation when request handler returns
author Kim Alvefur <zash@zash.se>
date Tue, 04 Apr 2017 00:16:17 +0200
parent 2666:99c0b1bacdcd
child 2677:6daaa1ad2559
comparison
equal deleted inserted replaced
2666:99c0b1bacdcd 2667:0c7802b95820
121 module:hook("iq/host/"..namespace..":request", function (event) 121 module:hook("iq/host/"..namespace..":request", function (event)
122 local stanza, origin = event.stanza, event.origin; 122 local stanza, origin = event.stanza, event.origin;
123 local request = stanza.tags[1]; 123 local request = stanza.tags[1];
124 local filename = request.attr.filename; 124 local filename = request.attr.filename;
125 local filesize = tonumber(request.attr.size); 125 local filesize = tonumber(request.attr.size);
126 handle_request(origin, stanza, namespace, filename, filesize); 126 return handle_request(origin, stanza, namespace, filename, filesize);
127 end); 127 end);
128 128
129 module:hook("iq/host/"..legacy_namespace..":request", function (event) 129 module:hook("iq/host/"..legacy_namespace..":request", function (event)
130 local stanza, origin = event.stanza, event.origin; 130 local stanza, origin = event.stanza, event.origin;
131 local request = stanza.tags[1]; 131 local request = stanza.tags[1];
132 local filename = request:get_child_text("filename"); 132 local filename = request:get_child_text("filename");
133 local filesize = tonumber(request:get_child_text("size")); 133 local filesize = tonumber(request:get_child_text("size"));
134 handle_request(origin, stanza, legacy_namespace, filename, filesize); 134 return handle_request(origin, stanza, legacy_namespace, filename, filesize);
135 end); 135 end);
136 136
137 -- http service 137 -- http service
138 local function upload_data(event, path) 138 local function upload_data(event, path)
139 local uploader = pending_slots[path]; 139 local uploader = pending_slots[path];