From 4fe3ec81e1ca2f13fd945e9afcaf5af2733ade73 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 18 Aug 2016 14:50:06 +0200 Subject: net.http.parser: Allow limits to be configurable via options callback --- net/http/parser.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/http') 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; -- cgit v1.2.3