summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--modules/base/luasrc/http/protocol.lua2
-rw-r--r--modules/base/luasrc/ltn12.lua1
2 files changed, 2 insertions, 1 deletions
diff --git a/modules/base/luasrc/http/protocol.lua b/modules/base/luasrc/http/protocol.lua
index 0d41550b23..6431b04031 100644
--- a/modules/base/luasrc/http/protocol.lua
+++ b/modules/base/luasrc/http/protocol.lua
@@ -658,7 +658,7 @@ function parse_message_body( src, msg, filecb )
if not ok and err then
return nil, err
- elseif not err then
+ elseif not ok then -- eof
return true
end
end
diff --git a/modules/base/luasrc/ltn12.lua b/modules/base/luasrc/ltn12.lua
index 9371290c61..b59fb8c48a 100644
--- a/modules/base/luasrc/ltn12.lua
+++ b/modules/base/luasrc/ltn12.lua
@@ -144,6 +144,7 @@ function source.file(handle, io_err)
if handle then
return function()
local chunk = handle:read(BLOCKSIZE)
+ if chunk and chunk:len() == 0 then chunk = nil end
if not chunk then handle:close() end
return chunk
end