aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-11-20 15:01:47 +0100
committerKim Alvefur <zash@zash.se>2014-11-20 15:01:47 +0100
commit1875a89b0269a92b965298f3ca9f234630e11721 (patch)
tree1942217f4c99d9e88151d983acabdd514ac04386 /net
parent1717f1f2e18c51a7c3091f4a98f35db0b1de6860 (diff)
parent6d35997e95d6491c72dcfc4b1ecf782e7542fbe5 (diff)
downloadprosody-1875a89b0269a92b965298f3ca9f234630e11721.tar.gz
prosody-1875a89b0269a92b965298f3ca9f234630e11721.zip
Merge 0.10->trunk
Diffstat (limited to 'net')
-rw-r--r--net/http/parser.lua12
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;