Mercurial > prosody-modules
changeset 2743:1fa9620220e3
merge commit
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Thu, 17 Aug 2017 21:34:56 +0200 |
parents | 57d4680b86a4 (diff) 2e30bb3a10d5 (current diff) |
children | f70c02c14161 |
files | |
diffstat | 2 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua Thu Aug 17 21:32:52 2017 +0200 +++ b/mod_http_upload/mod_http_upload.lua Thu Aug 17 21:34:56 2017 +0200 @@ -256,8 +256,12 @@ local status_line = "HTTP/"..response.request.httpversion.." "..(response.status or codes[response.status_code]); local headers = response.headers; - body = body or response.body or ""; - headers.content_length = #body; + if type(body) == "string" then + headers.content_length = #body; + elseif io.type(body) == "file" then + headers.content_length = body:seek("end"); + body:close(); + end local output = { status_line }; for k,v in pairs(headers) do @@ -282,6 +286,7 @@ local function serve_head(event, path) event.response.send = send_response_sans_body; + event.response.send_file = send_response_sans_body; return serve_uploaded_files(event, path); end
--- a/mod_register_web/mod_register_web.lua Thu Aug 17 21:32:52 2017 +0200 +++ b/mod_register_web/mod_register_web.lua Thu Aug 17 21:34:56 2017 +0200 @@ -1,6 +1,7 @@ local captcha_options = module:get_option("captcha_options", {}); local nodeprep = require "util.encodings".stringprep.nodeprep; local usermanager = require "core.usermanager"; +local datamanager = require "util.datamanager"; local http = require "net.http"; local path_sep = package.config:sub(1,1); local json = require "util.json".decode; @@ -39,12 +40,12 @@ function generate_captcha(display_options) return recaptcha_tpl.apply(setmetatable({ - recaptcha_display_error = display_options and display_options.recaptcha_error - and ("&error="..display_options.recaptcha_error) or ""; - }, { - __index = function (t, k) - if captcha_options[k] then return captcha_options[k]; end - module:log("error", "Missing parameter from captcha_options: %s", k); + recaptcha_display_error = display_options and display_options.recaptcha_error + and ("&error="..display_options.recaptcha_error) or ""; + }, { + __index = function (t, k) + if captcha_options[k] then return captcha_options[k]; end + module:log("error", "Missing parameter from captcha_options: %s", k); end })); end