# HG changeset patch # User Kim Alvefur # Date 1465692668 -7200 # Node ID c45ad4b7aaa36bcbfff34a4c50f5a388cf0b7f6e # Parent 724809023c92a03b2ac0ef4f11e5661764616072 mod_http_upload: Add additional debug logging diff -r 724809023c92 -r c45ad4b7aaa3 mod_http_upload/mod_http_upload.lua --- a/mod_http_upload/mod_http_upload.lua Fri Jun 10 14:58:39 2016 +0200 +++ b/mod_http_upload/mod_http_upload.lua Sun Jun 12 02:51:08 2016 +0200 @@ -50,17 +50,20 @@ local request = stanza.tags[1]; -- local clients only if origin.type ~= "c2s" then + module:log("debug", "Request for upload slot from a %s", origin.type); origin.send(st.error_reply(stanza, "cancel", "not-authorized")); return true; end -- validate local filename = request:get_child_text("filename"); if not filename or filename:find("/") then + module:log("debug", "Filename %q not allowed", filename or ""); origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid filename")); return true; end local filesize = tonumber(request:get_child_text("size")); if not filesize then + module:log("debug", "Missing file size"); origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing or invalid file size")); return true; elseif filesize > file_size_limit then @@ -77,6 +80,7 @@ reply:tag("get"):text(url):up(); reply:tag("put"):text(url):up(); origin.send(reply); + origin.log("debug", "Given upload slot %q", random); return true; end); @@ -88,6 +92,7 @@ end local random, filename = path:match("^([^/]+)/([^/]+)$"); if not random then + module:log("warn", "Invalid file path %q", path); return 400; end if #event.request.body > file_size_limit then