diff options
author | Matthew Wild <mwild1@gmail.com> | 2023-02-17 17:02:41 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2023-02-17 17:02:41 +0000 |
commit | ff518909108e0c0385f666d4ab251f3374a2c37b (patch) | |
tree | 482ff3334a50f2fd07a5252e832033e59018fd02 /net | |
parent | 02b01c48265d550c0fdc0521cdc4a86e6aad94c1 (diff) | |
parent | 87ee5a2300ef296fc3c11e6d3d1c9be23d289252 (diff) | |
download | prosody-ff518909108e0c0385f666d4ab251f3374a2c37b.tar.gz prosody-ff518909108e0c0385f666d4ab251f3374a2c37b.zip |
Merge 0.12->trunk
Diffstat (limited to 'net')
-rw-r--r-- | net/http/parser.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua index b95d9017..a6624662 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -153,6 +153,7 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) if not chunk_size then return; end chunk_size = chunk_size and tonumber(chunk_size, 16); if not chunk_size then error = true; return error_cb("invalid-chunk-size"); end + if chunk_size == 0 and chunk_header:find("\r\n\r\n", chunk_start-2, true) then local body_buffer = packet.body_buffer; if body_buffer then @@ -168,8 +169,8 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) state, chunked = nil, nil; packet.partial = nil; success_cb(packet); - elseif buffer:length() - chunk_start - 2 >= chunk_size then -- we have a chunk - buffer:discard(chunk_start - 1); -- TODO verify that it's not off-by-one + elseif buffer:length() - chunk_start - 1 >= chunk_size then -- we have a chunk + buffer:discard(chunk_start - 1); (packet.body_sink or packet.body_buffer):write(buffer:read(chunk_size)); buffer:discard(2); -- CRLF else -- Partial chunk remaining |