aboutsummaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-26 16:39:04 +0200
committerKim Alvefur <zash@zash.se>2016-08-26 16:39:04 +0200
commitd51cb366d537de9189fb9ac365dc7ad025820a67 (patch)
tree051d6b233af21d8536e9f7786ccbda892ac203be /net/http
parent266c9ad4eb1f23e6edba5201762007ac3a7419a1 (diff)
downloadprosody-d51cb366d537de9189fb9ac365dc7ad025820a67.tar.gz
prosody-d51cb366d537de9189fb9ac365dc7ad025820a67.zip
net.http.parser: Fix missing buffer length adjustment when parsing chunked streams
Diffstat (limited to 'net/http')
-rw-r--r--net/http/parser.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua
index fabbddad..493ff3a9 100644
--- a/net/http/parser.lua
+++ b/net/http/parser.lua
@@ -150,6 +150,7 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb)
elseif buflen - chunk_start - 2 >= chunk_size then -- we have a chunk
packet.body = packet.body..buf:sub(chunk_start, chunk_start + (chunk_size-1));
buf = buf:sub(chunk_start + chunk_size + 2);
+ buflen = buflen - (chunk_start + chunk_size + 2 - 1);
chunk_size, chunk_start = nil, nil;
else -- Partial chunk remaining
break;