comparison mod_http_upload/mod_http_upload.lua @ 2208:e654d6e1fb50

mod_http_upload: Log if file size exceeds limit
author Kim Alvefur <zash@zash.se>
date Sun, 12 Jun 2016 03:21:48 +0200
parents c45ad4b7aaa3
children 131075a3bf0d
comparison
equal deleted inserted replaced
2207:c45ad4b7aaa3 2208:e654d6e1fb50
65 if not filesize then 65 if not filesize then
66 module:log("debug", "Missing file size"); 66 module:log("debug", "Missing file size");
67 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing or invalid file size")); 67 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing or invalid file size"));
68 return true; 68 return true;
69 elseif filesize > file_size_limit then 69 elseif filesize > file_size_limit then
70 module:log("debug", "File too large (%d > %d)", filesize, file_size_limit);
70 origin.send(st.error_reply(stanza, "modify", "not-acceptable", "File too large", 71 origin.send(st.error_reply(stanza, "modify", "not-acceptable", "File too large",
71 st.stanza("file-too-large", {xmlns=xmlns_http_upload}) 72 st.stanza("file-too-large", {xmlns=xmlns_http_upload})
72 :tag("max-size"):text(tostring(file_size_limit)))); 73 :tag("max-size"):text(tostring(file_size_limit))));
73 return true; 74 return true;
74 end 75 end