# HG changeset patch # User jbe # Date 1434735323 -7200 # Node ID ab12ecb399f130dde3483fafa72416f4757c3a18 # Parent a6a704ca86ee11946259fd085b4199e5cbab4e80 Signal request body EOF in HTTP module diff -r a6a704ca86ee -r ab12ecb399f1 moonbridge_http.lua --- a/moonbridge_http.lua Fri Jun 19 19:27:01 2015 +0200 +++ b/moonbridge_http.lua Fri Jun 19 19:35:23 2015 +0200 @@ -537,6 +537,9 @@ elseif request_body_content_length then read_body_bytes(request_body_content_length) end + if process_body_chunk then + process_body_chunk(nil) -- signal EOF + end consume = nil -- avoid further resumes end -- function to setup default request body handling: @@ -950,10 +953,15 @@ error("Cannot setup request body streamer at this stage anymore") end local inprogress = false + local eof = false local buffer = {} process_body_chunk = function(chunk) if inprogress then - buffer[#buffer+1] = chunk + if chunk == nil then + eof = true + else + buffer[#buffer+1] = chunk + end else inprogress = true callback(chunk) @@ -962,6 +970,9 @@ buffer = {} callback(chunk) end + if eof then + callback() -- signal EOF + end inprogress = false end end