summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@mailme.dk>2012-12-27 19:58:20 +0100
committerEmil Renner Berthing <esmil@mailme.dk>2013-01-04 21:12:37 +0100
commit2c7077309341aad9f831ae8cf356899a18ee4e3b (patch)
treef9d257a0892e46d2e1962987cc1c9cf58dcbcefa
parent53c045bb3fc00f5e5f68d805f43b2cb1a9173dc3 (diff)
downloadlem-2c7077309341aad9f831ae8cf356899a18ee4e3b.tar.gz
lem-2c7077309341aad9f831ae8cf356899a18ee4e3b.tar.xz
lem-2c7077309341aad9f831ae8cf356899a18ee4e3b.zip
http: support no Content-Length when Connection: close
-rw-r--r--lem/http.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lem/http.lua b/lem/http.lua
index 8a14961..f754b09 100644
--- a/lem/http.lua
+++ b/lem/http.lua
@@ -80,7 +80,12 @@ function http.Response:body()
end
local num = self.headers['Content-Length']
- if not num then return nil, 'no content length specified' end
+ if not num then
+ if self.headers['Connection'] == 'close' then
+ return self.client:read('*a')
+ end
+ return nil, 'no content length specified'
+ end
num = tonumber(num)
if not num then return nil, 'invalid content length' end