# HG changeset patch # User jbe # Date 1434755286 -7200 # Node ID 6927f8897f7154507680c95abc79bd6e7a711b0a # Parent efd1b4cfd2e9a85fe4391709b2fc5f951b937538 Avoid hang-up on empty/nonexistent body in moonbridge_http.lua diff -r efd1b4cfd2e9 -r 6927f8897f71 moonbridge_http.lua --- a/moonbridge_http.lua Sat Jun 20 00:46:19 2015 +0200 +++ b/moonbridge_http.lua Sat Jun 20 01:08:06 2015 +0200 @@ -502,6 +502,7 @@ -- coroutine for request body processing: local function read_body() if request.headers_flags["Transfer-Encoding"]["chunked"] then + coroutine.yield() -- do not read on first invocation local limit = body_size_limit while true do local line = read(32 + limit, "\n") @@ -536,6 +537,7 @@ end end elseif request_body_content_length then + coroutine.yield() -- do not read on first invocation read_body_bytes(request_body_content_length) end if process_body_chunk then @@ -723,6 +725,7 @@ return end consume = coroutine.wrap(read_body) + consume() -- call coroutine once to avoid hangup on empty body state = "no_status_sent" if request.headers_flags["Expect"]["100-continue"] then request:send_status("100 Continue")