Changeset

7634:b1132d74f54c

net.http.parser: Fix missing buffer length adjustment when parsing chunked streams
author Kim Alvefur <zash@zash.se>
date Fri, 26 Aug 2016 16:39:04 +0200
parents 7632:2b14e2121700
children 7635:6879a220917b
files net/http/parser.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/parser.lua	Fri Apr 17 12:03:15 2015 +0200
+++ b/net/http/parser.lua	Fri Aug 26 16:39:04 2016 +0200
@@ -150,6 +150,7 @@
 							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;