diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-15 21:21:57 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-15 21:21:57 +0100 |
commit | 01d1134ca40ee32b1d84d10181c4d22e60669456 (patch) | |
tree | 02949c230f40ca6734b9263cca7e2d1caae3bdee /net/http/parser.lua | |
parent | d1c7fed605d0616e3b2d68c69a35879f705c0422 (diff) | |
download | prosody-01d1134ca40ee32b1d84d10181c4d22e60669456.tar.gz prosody-01d1134ca40ee32b1d84d10181c4d22e60669456.zip |
net.http.parser: Fix off-by-one error in chunked encoding parser
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r-- | net/http/parser.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua index 34742d2b..9688e052 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -133,7 +133,8 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) buf = buf:gsub("^.-\r\n\r\n", ""); -- This ensure extensions and trailers are stripped success_cb(packet); elseif #buf - chunk_start + 2 >= chunk_size then -- we have a chunk - packet.body = packet.body..buf:sub(chunk_start, chunk_start + chunk_size); + print(chunk_start, chunk_size, ("%q"):format(buf)) + packet.body = packet.body..buf:sub(chunk_start, chunk_start + (chunk_size-1)); buf = buf:sub(chunk_start + chunk_size + 2); chunk_size, chunk_start = nil, nil; else -- Partial chunk remaining |