net/http/parser.lua
changeset 11731 f3aee8a825cc
parent 11188 2ede7f43ccfe
child 12886 9ed628635dc6
equal deleted inserted replaced
11730:76156c675456 11731:f3aee8a825cc
    28 function httpstream.new(success_cb, error_cb, parser_type, options_cb)
    28 function httpstream.new(success_cb, error_cb, parser_type, options_cb)
    29 	local client = true;
    29 	local client = true;
    30 	if not parser_type or parser_type == "server" then client = false; else assert(parser_type == "client", "Invalid parser type"); end
    30 	if not parser_type or parser_type == "server" then client = false; else assert(parser_type == "client", "Invalid parser type"); end
    31 	local bodylimit = tonumber(options_cb and options_cb().body_size_limit) or 10*1024*1024;
    31 	local bodylimit = tonumber(options_cb and options_cb().body_size_limit) or 10*1024*1024;
    32 	-- https://stackoverflow.com/a/686243
    32 	-- https://stackoverflow.com/a/686243
    33 	-- Indiviual headers can be up to 16k? What madness?
    33 	-- Individual headers can be up to 16k? What madness?
    34 	local headlimit = tonumber(options_cb and options_cb().head_size_limit) or 10*1024;
    34 	local headlimit = tonumber(options_cb and options_cb().head_size_limit) or 10*1024;
    35 	local buflimit = tonumber(options_cb and options_cb().buffer_size_limit) or bodylimit * 2;
    35 	local buflimit = tonumber(options_cb and options_cb().buffer_size_limit) or bodylimit * 2;
    36 	local buffer = dbuffer.new(buflimit);
    36 	local buffer = dbuffer.new(buflimit);
    37 	local chunked;
    37 	local chunked;
    38 	local state = nil;
    38 	local state = nil;