# HG changeset patch # User Matthew Wild # Date 1451842235 0 # Node ID 7eff79ea9a01c42b4cc9119df9f4abb64bb98b20 # Parent d363a6692a10234d70cedaffabecf3c00030ea17 net.http.parser: Support success_on_chunk when chunked encoding isn't being used (i.e. streaming mode) diff -r d363a6692a10 -r 7eff79ea9a01 net/http/parser.lua --- a/net/http/parser.lua Thu Dec 25 10:48:06 2014 +0000 +++ b/net/http/parser.lua Sun Jan 03 17:30:35 2016 +0000 @@ -146,12 +146,17 @@ 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); + elseif success_on_chunk then + packet.partial = true; + packet.body = buf; + success_cb(packet); + buf = packet.body; else break; end