Changeset

6524:185817ef4a4d

Merge 0.9->0.10
author Kim Alvefur <zash@zash.se>
date Thu, 20 Nov 2014 15:00:52 +0100
parents 6521:29c7586665f5 (current diff) 6523:63d3126b75f1 (diff)
children 6525:7c273da3cff6 6526:873538f0b18c
files
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/parser.lua	Wed Nov 19 14:47:49 2014 +0100
+++ b/net/http/parser.lua	Thu Nov 20 15:00:52 2014 +0100
@@ -132,7 +132,7 @@
 								state, chunk_size = nil, nil;
 								buf = buf:gsub("^.-\r\n\r\n", ""); -- This ensure extensions and trailers are stripped
 								success_cb(packet);
-							elseif #buf - chunk_start + 2 >= chunk_size then -- we have a chunk
+							elseif #buf - 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);
 								chunk_size, chunk_start = nil, nil;
@@ -140,11 +140,11 @@
 								break;
 							end
 						elseif len and #buf >= len then
-                                                       if packet.code == 101 then
-                                                               packet.body, buf = buf, ""
-                                                       else
-                                                               packet.body, buf = buf:sub(1, len), buf:sub(len + 1);
-                                                       end
+							if packet.code == 101 then
+								packet.body, buf = buf, "";
+							else
+								packet.body, buf = buf:sub(1, len), buf:sub(len + 1);
+							end
 							state = nil; success_cb(packet);
 						else
 							break;