diff options
author | 2023-10-13 17:47:05 -0700 | |
---|---|---|
committer | 2023-10-13 17:47:05 -0700 | |
commit | 77d7e47019753bacc76306dd9066df25c67c51a9 (patch) | |
tree | 40f4b058deb09ffe39f35f06f198f94e98605874 /src | |
parent | 1bad64bc5e6fc2757a99dc7529d11c86835300bb (diff) | |
download | bun-77d7e47019753bacc76306dd9066df25c67c51a9.tar.gz bun-77d7e47019753bacc76306dd9066df25c67c51a9.tar.zst bun-77d7e47019753bacc76306dd9066df25c67c51a9.zip |
Fix dns.lookup returning wrong address for family (#6474)
* Fix #6452
* Fix formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/api/bun/dns_resolver.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bun.js/api/bun/dns_resolver.zig b/src/bun.js/api/bun/dns_resolver.zig index 873cdcddc..3c20f4df7 100644 --- a/src/bun.js/api/bun/dns_resolver.zig +++ b/src/bun.js/api/bun/dns_resolver.zig @@ -102,11 +102,12 @@ const LibInfo = struct { ) catch unreachable; const promise_value = request.head.promise.value(); + const hints = query.options.toLibC(); const errno = getaddrinfo_async_start_( &request.backend.libinfo.machport, name_z.ptr, null, - null, + if (hints != null) &hints.? else null, GetAddrInfoRequest.getAddrInfoAsyncCallback, request, ); @@ -2475,7 +2476,7 @@ pub const DNSResolver = struct { return dns_lookup.promise.value(); } - // var hints_buf = &[_]c_ares.AddrInfo_hints{query.toCAres()}; + var hints_buf = &[_]c_ares.AddrInfo_hints{query.toCAres()}; var request = GetAddrInfoRequest.init( cache, .{ @@ -2491,7 +2492,7 @@ pub const DNSResolver = struct { channel.getAddrInfo( query.name, query.port, - &.{}, + hints_buf, GetAddrInfoRequest, request, GetAddrInfoRequest.onCaresComplete, |