If no content-length, read all. see issue #431

This commit is contained in:
Cloud Wu
2016-01-07 16:01:17 +08:00
parent c175d66e23
commit d7a76c7c72
2 changed files with 4 additions and 1 deletions

View File

@@ -72,7 +72,8 @@ local function request(fd, method, host, url, recvheader, header, content)
body = body .. padding
end
else
body = nil
-- no content-length, read all
body = body .. socket.readall(fd)
end
end

View File

@@ -19,6 +19,8 @@ function sockethelper.readfunc(fd)
end
end
sockethelper.readall = socket.readall
function sockethelper.writefunc(fd)
return function(content)
local ok = writebytes(fd, content)