From 9bdc36526ef5e5094b629d800421509e2638a6ee Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Wed, 22 Oct 2014 11:29:03 +0800 Subject: [PATCH] close socket after request --- lualib/http/httpc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lualib/http/httpc.lua b/lualib/http/httpc.lua index 784b186bb..a73d5710e 100644 --- a/lualib/http/httpc.lua +++ b/lualib/http/httpc.lua @@ -81,10 +81,10 @@ function httpc.request(method, host, url, recvheader, header, content) end local fd = socket.connect(hostname, port) local ok , statuscode, body = pcall(request, fd,method, host, url, recvheader, header, content) + socket.close(fd) if ok then return statuscode, body else - socket.close(fd) error(statuscode) end end