Skip to content

Commit a8458ca

Browse files
committed
http/client: Throw error early if .path given and non AF_UNIX family
1 parent c46e2f5 commit a8458ca

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

http/client.lua

+9-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ local function connect(options, timeout)
127127
family = cs.AF_UNSPEC
128128
end
129129

130+
local path = options.path
131+
if path then
132+
if family ~= cs.AF_UNSPEC then
133+
family = cs.AF_UNIX
134+
elseif family ~= cs.AF_UNIX then
135+
error("cannot use .path with non-unix address family")
136+
end
137+
end
138+
130139
local bind = options.bind
131140
if bind ~= nil then
132141
assert(type(bind) == "string")
@@ -157,7 +166,6 @@ local function connect(options, timeout)
157166
}
158167
end
159168

160-
local path = options.path
161169
local host = options.host
162170
if not path and not http_util.is_ip(host) then
163171
local dns_resolver = options.dns_resolver or cqueues_dns.getpool()

0 commit comments

Comments
 (0)