Changeset

6386:f942cf2a9a03

net.http.parser: Support status code 101 and allow handling of the received data by someone else
author Matthew Wild <mwild1@gmail.com>
date Wed, 03 Sep 2014 18:49:41 +0100
parents 6381:9ffd582c65d8
children 6387:6d769afd0bc5 6401:e3de64f7c44d
files net/http/parser.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/net/http/parser.lua	Tue Sep 02 17:23:44 2014 +0100
+++ b/net/http/parser.lua	Wed Sep 03 18:49:41 2014 +0100
@@ -140,7 +140,11 @@
 								break;
 							end
 						elseif len and #buf >= len then
-							packet.body, buf = buf:sub(1, len), buf:sub(len + 1);
+                                                       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;