# HG changeset patch # User Kim Alvefur # Date 1471524606 -7200 # Node ID 65bf55fdf971bb8bf634ba4989ab762be36fba14 # Parent 3dc52f1778db8c324a9104010721fd05e69e880e net.http.parser: Allow limits to be configurable via options callback diff -r 3dc52f1778db -r 65bf55fdf971 net/http/parser.lua --- 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;