net.http.parser: Break when no more usable data in buffer (client part of e5ec60dfb202)
authorMatthew Wild <mwild1@gmail.com>
Thu, 11 Apr 2013 17:39:10 +0100
changeset 5461 67b674f6a299
parent 5460 274c10668fe8
child 5462 3ecae471d9dd
net.http.parser: Break when no more usable data in buffer (client part of e5ec60dfb202)
net/http/parser.lua
--- a/net/http/parser.lua	Thu Apr 11 17:37:37 2013 +0100
+++ b/net/http/parser.lua	Thu Apr 11 17:39:10 2013 +0100
@@ -136,6 +136,8 @@
 						elseif len and #buf >= len then
 							packet.body, buf = buf:sub(1, len), buf:sub(len + 1);
 							state = nil; success_cb(packet);
+						else
+							break;
 						end
 					elseif #buf >= len then
 						packet.body, buf = buf:sub(1, len), buf:sub(len + 1);