Changeset

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 2284:1266f5c17c0d
children 2286:0a3f526779a1
files mod_http_upload/mod_http_upload.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload/mod_http_upload.lua	Sat Aug 20 18:33:43 2016 +0200
+++ b/mod_http_upload/mod_http_upload.lua	Sat Aug 20 21:59:39 2016 +0200
@@ -24,6 +24,13 @@
 -- config
 local file_size_limit = module:get_option_number(module.name .. "_file_size_limit", 1024 * 1024); -- 1 MB
 
+--- sanity
+local parser_body_limit = module:context("*"):get_option_number("http_max_content_size", 10*1024*1024);
+if file_size_limit > parser_body_limit then
+	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);
+	file_size_limit = parser_body_limit;
+end
+
 -- depends
 module:depends("http");
 module:depends("disco");