net.http.parser: Don't collapse buffer when expecting a chunk and not enough data has been received
authorKim Alvefur <zash@zash.se>
Fri, 26 Aug 2016 16:42:14 +0200
changeset 7638 6879a220917b
parent 7637 b1132d74f54c
child 7639 7674cb520557
child 7641 a23b5cb8c22b
net.http.parser: Don't collapse buffer when expecting a chunk and not enough data has been received
net/http/parser.lua
--- a/net/http/parser.lua	Fri Aug 26 16:39:04 2016 +0200
+++ b/net/http/parser.lua	Fri Aug 26 16:42:14 2016 +0200
@@ -134,6 +134,9 @@
 				if state then -- read body
 					if client then
 						if chunked then
+							if chunk_start and buflen - chunk_start - 2 < chunk_size then
+								return;
+							end -- not enough data
 							if buftable then buf, buftable = t_concat(buf), false; end
 							if not buf:find("\r\n", nil, true) then
 								return;