Software /
code /
prosody
Comparison
net/http/parser.lua @ 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 |
parent | 7577:3dc52f1778db |
child | 7581:01d0d466d7be |
comparison
equal
deleted
inserted
replaced
7577:3dc52f1778db | 7578:65bf55fdf971 |
---|---|
27 | 27 |
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 buf, buflen, buftable = {}, 0, true; | 31 local buf, buflen, buftable = {}, 0, true; |
32 local bodylimit = 10*1024*1024; | 32 local bodylimit = tonumber(options_cb and options_cb().body_size_limit) or 10*1024*1024; |
33 local buflimit = bodylimit * 2; | 33 local buflimit = tonumber(options_cb and options_cb().buffer_size_limit) or bodylimit * 2; |
34 local chunked, chunk_size, chunk_start; | 34 local chunked, chunk_size, chunk_start; |
35 local state = nil; | 35 local state = nil; |
36 local packet; | 36 local packet; |
37 local len; | 37 local len; |
38 local have_body; | 38 local have_body; |