Changeset

7578:65bf55fdf971

net.http.parser: Allow limits to be configurable via options callback
author Kim Alvefur <zash@zash.se>
date Thu, 18 Aug 2016 14:50:06 +0200
parents 7577:3dc52f1778db
children 7579:d430573fe9f8
files net/http/parser.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/parser.lua	Thu Aug 18 14:48:42 2016 +0200
+++ b/net/http/parser.lua	Thu Aug 18 14:50:06 2016 +0200
@@ -29,8 +29,8 @@
 	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;