# HG changeset patch # User Matthew Wild # Date 1409766581 -3600 # Node ID f942cf2a9a0377c76ce74830ba988dcf0f7265a8 # Parent 9ffd582c65d8c2575d557d69717624d4580c5b14 net.http.parser: Support status code 101 and allow handling of the received data by someone else diff -r 9ffd582c65d8 -r f942cf2a9a03 net/http/parser.lua --- 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;