aboutsummaryrefslogtreecommitdiffstats
path: root/net/http/parser.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-09-03 18:49:41 +0100
committerMatthew Wild <mwild1@gmail.com>2014-09-03 18:49:41 +0100
commitf5bf37762b749a16cb9b87f3f72a1a4ed5540901 (patch)
tree6bf3157776667627934fb3902ac8de18ef2df5b4 /net/http/parser.lua
parent3af268b9b31b69c5c8704b1f22f41d9bf395073e (diff)
downloadprosody-f5bf37762b749a16cb9b87f3f72a1a4ed5540901.tar.gz
prosody-f5bf37762b749a16cb9b87f3f72a1a4ed5540901.zip
net.http.parser: Support status code 101 and allow handling of the received data by someone else
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r--net/http/parser.lua6
1 files changed, 5 insertions, 1 deletions
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;