diff --git a/lualib/http/httpc.lua b/lualib/http/httpc.lua index 09ac9288..68d3ce9c 100644 --- a/lualib/http/httpc.lua +++ b/lualib/http/httpc.lua @@ -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 diff --git a/lualib/http/sockethelper.lua b/lualib/http/sockethelper.lua index febe4cea..cac3130d 100644 --- a/lualib/http/sockethelper.lua +++ b/lualib/http/sockethelper.lua @@ -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)