diff --git a/lualib/http/httpc.lua b/lualib/http/httpc.lua index 4f5880bf..a26a1505 100644 --- a/lualib/http/httpc.lua +++ b/lualib/http/httpc.lua @@ -72,6 +72,9 @@ local function request(interface, method, host, url, recvheader, header, content local padding = read(length - #body) body = body .. padding end + elseif code == 204 or code == 304 or code < 200 then + body = "" + -- See https://stackoverflow.com/questions/15991173/is-the-content-length-header-required-for-a-http-1-0-response else -- no content-length, read all body = body .. interface.readall()