Trying to get connect-with-timeout to work. Darwin works...
This commit is contained in:
parent
02ef4e7daa
commit
c8d58798f0
14 changed files with 232 additions and 198 deletions
|
@ -549,10 +549,16 @@ function request_cb(reqt, respt)
|
|||
reqt.headers = fill_headers(reqt.headers, parsed)
|
||||
-- try to connect to server
|
||||
local sock
|
||||
sock, respt.error = socket.connect(parsed.host, parsed.port)
|
||||
sock, respt.error = socket.tcp()
|
||||
if not sock then return respt end
|
||||
-- set connection timeout so that we do not hang forever
|
||||
sock:settimeout(TIMEOUT)
|
||||
local ret
|
||||
ret, respt.error = sock:connect(parsed.host, parsed.port)
|
||||
if not ret then
|
||||
sock:close()
|
||||
return respt
|
||||
end
|
||||
-- send request message
|
||||
respt.error = send_request(sock, reqt.method,
|
||||
request_uri(parsed), reqt.headers, reqt.body_cb)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue