aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-18 14:50:06 +0200
committerKim Alvefur <zash@zash.se>2016-08-18 14:50:06 +0200
commit73e6a5f7f5ff66f17b9745c4cf691e4b3078f456 (patch)
treeeec07a01aa46ab876ce335dd9e1f96c466aa5835
parent2aa4e86f3bd2b244a138eeeb4975a7f4609f9792 (diff)
downloadprosody-73e6a5f7f5ff66f17b9745c4cf691e4b3078f456.tar.gz
prosody-73e6a5f7f5ff66f17b9745c4cf691e4b3078f456.zip
net.http.parser: Allow limits to be configurable via options callback
-rw-r--r--net/http/parser.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua
index e3a2554f..1e698728 100644
--- a/net/http/parser.lua
+++ b/net/http/parser.lua
@@ -29,8 +29,8 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb)
local client = true;
if not parser_type or parser_type == "server" then client = false; else assert(parser_type == "client", "Invalid parser type"); end
local buf, buflen, buftable = {}, 0, true;
- local bodylimit = 10*1024*1024;
- local buflimit = bodylimit * 2;
+ local bodylimit = tonumber(options_cb and options_cb().body_size_limit) or 10*1024*1024;
+ local buflimit = tonumber(options_cb and options_cb().buffer_size_limit) or bodylimit * 2;
local chunked, chunk_size, chunk_start;
local state = nil;
local packet;