Skip to content

Commit 9f7c4b7

Browse files
fix: Fix resolving named hosts.
1 parent 0071d14 commit 9f7c4b7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pytest_socket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ def socket_allow_hosts(allowed=None, allow_unix_socket=False):
226226

227227
def guarded_connect(inst, *args):
228228
host = host_from_connect_args(args)
229+
if host and not is_ipaddress(host):
230+
host = resolve_hostname(host)
229231
if host in allowed_hosts or (
230232
_is_unix_socket(inst.family) and allow_unix_socket
231233
):

0 commit comments

Comments
 (0)