From: Matthew Wild Date: Wed, 3 Sep 2014 17:49:41 +0000 (+0100) Subject: net.http.parser: Support status code 101 and allow handling of the received data... X-Git-Url: https://git.enpas.org/?a=commitdiff_plain;h=d4bb7ec542d1d8c997a4c7e9a7659c5c7b8c1311;hp=85aa3f22c8e57ea9e3c03aa69fb970ccef5924cb;p=prosody.git net.http.parser: Support status code 101 and allow handling of the received data by someone else --- diff --git a/net/http/parser.lua b/net/http/parser.lua index f9e6cea0..d896dff4 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -140,7 +140,11 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) 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;