# HG changeset patch # User Matthew Wild # Date 1598015669 -3600 # Node ID cb55554438524d4e0c36802ff856bac99b9eaa1f # Parent 28de6841475083687e09752c552e408ae6a982bc net.http.parser: Allow configuration of the chunk size fed to the parser diff -r 28de68414750 -r cb5555443852 spec/net_http_parser_spec.lua --- a/spec/net_http_parser_spec.lua Fri Aug 21 14:12:51 2020 +0100 +++ b/spec/net_http_parser_spec.lua Fri Aug 21 14:14:29 2020 +0100 @@ -1,6 +1,8 @@ local http_parser = require "net.http.parser"; local sha1 = require "util.hashes".sha1; +local parser_input_bytes = 3; + local function CRLF(s) return (s:gsub("\n", "\r\n")); end @@ -14,7 +16,7 @@ end); local parser = http_parser.new(success_cb, error, stream:sub(1,4) == "HTTP" and "client" or "server") - for chunk in stream:gmatch("..?.?") do + for chunk in stream:gmatch("."..string.rep(".?", parser_input_bytes-1)) do parser:feed(chunk); end