aboutsummaryrefslogtreecommitdiffstats
path: root/spec/net_http_parser_spec.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-08-21 13:41:51 +0100
committerMatthew Wild <mwild1@gmail.com>2020-08-21 13:41:51 +0100
commit076d8b698f664a8a47a38e16f54157cb702f43a8 (patch)
tree83e6a72bcd1f2120ad5215332b27e67269dd9865 /spec/net_http_parser_spec.lua
parent031a8d8e6458cb2c5ba115a75cd4f404326f7acf (diff)
downloadprosody-076d8b698f664a8a47a38e16f54157cb702f43a8.tar.gz
prosody-076d8b698f664a8a47a38e16f54157cb702f43a8.zip
net.http.parser: Add failing test for (large?) chunk-encoded responses
Diffstat (limited to 'spec/net_http_parser_spec.lua')
-rw-r--r--spec/net_http_parser_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/net_http_parser_spec.lua b/spec/net_http_parser_spec.lua
index 4ac3cab9..6a35d717 100644
--- a/spec/net_http_parser_spec.lua
+++ b/spec/net_http_parser_spec.lua
@@ -1,4 +1,5 @@
local http_parser = require "net.http.parser";
+local sha1 = require "util.hashes".sha1;
local function test_stream(stream, expect)
local success_cb = spy.new(function (packet)
@@ -115,4 +116,15 @@ o
);
end);
end);
+
+ pending("should handle large chunked responses", function ()
+ local data = io.open("spec/inputs/httpstream-chunked-test.txt", "rb"):read("*a");
+
+ -- Just a sanity check... text editors and things may mess with line endings, etc.
+ assert.equal("25930f021785ae14053a322c2dbc1897c3769720", sha1(data, true), "test data malformed");
+
+ test_stream(data, {
+ body = string.rep("~", 11085), count = 2;
+ });
+ end);
end);