aboutsummaryrefslogtreecommitdiffstats
path: root/spec/net_http_parser_spec.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-08-21 14:14:29 +0100
committerMatthew Wild <mwild1@gmail.com>2020-08-21 14:14:29 +0100
commit54e37ffe8d4562adc974a61359a8bfef8e0dcd29 (patch)
treea08ff68c8bb9a2f580648847f0b392f291629515 /spec/net_http_parser_spec.lua
parent76dd86054ce12963190255a135cf7c16ba4c4615 (diff)
downloadprosody-54e37ffe8d4562adc974a61359a8bfef8e0dcd29.tar.gz
prosody-54e37ffe8d4562adc974a61359a8bfef8e0dcd29.zip
net.http.parser: Allow configuration of the chunk size fed to the parser
Diffstat (limited to 'spec/net_http_parser_spec.lua')
-rw-r--r--spec/net_http_parser_spec.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/net_http_parser_spec.lua b/spec/net_http_parser_spec.lua
index 1a86dbba..f71cad20 100644
--- a/spec/net_http_parser_spec.lua
+++ b/spec/net_http_parser_spec.lua
@@ -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 @@ local function test_stream(stream, expect)
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