aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commited2b537cbdab358b5bab6a39d34f67972129583e (patch)
tree051d6b233af21d8536e9f7786ccbda892ac203be /net
parent6468ca11f94facd9ae96252bca8bdad70eb8395e (diff)
downloadprosody-ed2b537cbdab358b5bab6a39d34f67972129583e.tar.gz
prosody-ed2b537cbdab358b5bab6a39d34f67972129583e.zip
net.http.parser: Fix missing buffer length adjustment when parsing chunked streams
Diffstat (limited to 'net')
-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;