equal
deleted
inserted
replaced
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; |