Skip to content

Commit 9bb493c

Browse files
committed
http/client: Exit early if no records found
1 parent 6218598 commit 9bb493c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

http/client.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ local function connect(options, timeout)
273273

274274
local records = lookup_records(options, timeout)
275275

276+
local lasterr, lasterrno = "The name does not resolve for the supplied parameters", nil
277+
if records.n == 0 then
278+
return nil, lasterr, lasterrno
279+
end
280+
276281
local bind = options.bind
277282
if bind ~= nil then
278283
assert(type(bind) == "string")
@@ -303,7 +308,6 @@ local function connect(options, timeout)
303308
nodelay = true;
304309
}
305310

306-
local lasterr, lasterrno = "The name does not resolve for the supplied parameters"
307311
local i = 1
308312
while i <= records.n do
309313
local rec = records[i]

0 commit comments

Comments
 (0)