diff options
author | Kim Alvefur <zash@zash.se> | 2014-11-20 15:00:52 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-11-20 15:00:52 +0100 |
commit | b32f290795cd6fa60cca8433399eec5fe561bbbc (patch) | |
tree | d923b1c2b876061a9845a8e92e394815218a487a /net/http/parser.lua | |
parent | 727c5935a8fefa27883a92ffc50e32c3b3d29e17 (diff) | |
parent | a7d88ea2334bf18857b50cf7032ec3a3a79762fa (diff) | |
download | prosody-b32f290795cd6fa60cca8433399eec5fe561bbbc.tar.gz prosody-b32f290795cd6fa60cca8433399eec5fe561bbbc.zip |
Merge 0.9->0.10
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r-- | net/http/parser.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua index d896dff4..6d7187da 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -132,7 +132,7 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) 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 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) 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; |