Merge pull request #749 from chengdd1987/master

http中connect可能会连接失败,不应当将错误的fd继续传递下去
This commit is contained in:
云风
2017-10-18 09:44:43 +08:00
committed by GitHub

View File

@@ -100,6 +100,10 @@ function httpc.request(method, host, url, recvheader, header, content)
hostname = dns.resolve(hostname)
end
local fd = socket.connect(hostname, port, timeout)
if not fd then
error(string.format("http connect error host:%s, port:%s, timeout:%s", hostname, port, timeout))
return
end
local finish
if timeout then
skynet.timeout(timeout, function()