From 7e42653f80dfeb8d8aef044cb78e85cced125eb5 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Mon, 29 Jul 2019 16:53:11 +0800 Subject: [PATCH] fix #1057 --- lualib/http/httpc.lua | 3 +++ 1 file changed, 3 insertions(+) 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()