Mercurial > prosody-modules
comparison mod_http_upload/mod_http_upload.lua @ 2285:f1923bf329a3
mod_http_upload: Warn if upload size limit set higher than body size limit in http parser (applies to 0.10+)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 20 Aug 2016 21:59:39 +0200 |
parents | 131075a3bf0d |
children | 0a3f526779a1 |
comparison
equal
deleted
inserted
replaced
2284:1266f5c17c0d | 2285:f1923bf329a3 |
---|---|
21 return a .. package.config:sub(1,1) .. b; | 21 return a .. package.config:sub(1,1) .. b; |
22 end | 22 end |
23 | 23 |
24 -- config | 24 -- config |
25 local file_size_limit = module:get_option_number(module.name .. "_file_size_limit", 1024 * 1024); -- 1 MB | 25 local file_size_limit = module:get_option_number(module.name .. "_file_size_limit", 1024 * 1024); -- 1 MB |
26 | |
27 --- sanity | |
28 local parser_body_limit = module:context("*"):get_option_number("http_max_content_size", 10*1024*1024); | |
29 if file_size_limit > parser_body_limit then | |
30 module:log("warn", "%s_file_size_limit exceeds HTTP parser limit on body size, capping file size to %d B", module.name, parser_body_limit); | |
31 file_size_limit = parser_body_limit; | |
32 end | |
26 | 33 |
27 -- depends | 34 -- depends |
28 module:depends("http"); | 35 module:depends("http"); |
29 module:depends("disco"); | 36 module:depends("disco"); |
30 | 37 |