diff options
author | Kim Alvefur <zash@zash.se> | 2016-08-26 16:57:53 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-08-26 16:57:53 +0200 |
commit | 95f854650407ddb214a40805a5d7c8567b6dcc92 (patch) | |
tree | 2151226ea95bb3a632b411087eb5cc28f6c81ded /net/http/parser.lua | |
parent | cca5b1dec7762e7f5549a2b387a72e9fda602809 (diff) | |
parent | 5c1d761d865bd10e47433b33a5c6c2a2287c8e27 (diff) | |
download | prosody-95f854650407ddb214a40805a5d7c8567b6dcc92.tar.gz prosody-95f854650407ddb214a40805a5d7c8567b6dcc92.zip |
Merge 0.10->trunk
Diffstat (limited to 'net/http/parser.lua')
-rw-r--r-- | net/http/parser.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/http/parser.lua b/net/http/parser.lua index fabbddad..96d32ec8 100644 --- a/net/http/parser.lua +++ b/net/http/parser.lua @@ -134,6 +134,9 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) if state then -- read body if client then if chunked then + if chunk_start and buflen - chunk_start - 2 < chunk_size then + return; + end -- not enough data if buftable then buf, buftable = t_concat(buf), false; end if not buf:find("\r\n", nil, true) then return; @@ -150,6 +153,7 @@ function httpstream.new(success_cb, error_cb, parser_type, options_cb) elseif buflen - 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); + buflen = buflen - (chunk_start + chunk_size + 2 - 1); chunk_size, chunk_start = nil, nil; else -- Partial chunk remaining break; |