Skip to content

Commit

Permalink
close socket after request
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Oct 22, 2014
1 parent 24857a3 commit 9bdc365
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lualib/http/httpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9bdc365

Please sign in to comment.