Skip to content

Commit e8fc3d4

Browse files
lpincatargos
authored andcommitted
dns: call handle.setServers() with a valid array
`handle.setServers()` takes an array, not a string. PR-URL: #50811 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent cc5e790 commit e8fc3d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎lib/internal/dns/utils.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const{
44
ArrayPrototypeForEach,
5-
ArrayPrototypeJoin,
65
ArrayPrototypeMap,
76
ArrayPrototypePush,
87
FunctionPrototypeBind,
@@ -143,12 +142,15 @@ class ResolverBase{
143142
}
144143

145144
[kSetServersInteral](newSet,servers){
146-
constorig=this._handle.getServers()||[];
145+
constorig=ArrayPrototypeMap(this._handle.getServers()||[],(val)=>{
146+
val.unshift(isIP(val[0]));
147+
returnval;
148+
});
147149
consterrorNumber=this._handle.setServers(newSet);
148150

149151
if(errorNumber!==0){
150152
// Reset the servers to the old servers, because ares probably unset them.
151-
this._handle.setServers(ArrayPrototypeJoin(orig,','));
153+
this._handle.setServers(orig);
152154
const{ strerror }=lazyBinding();
153155
consterr=strerror(errorNumber);
154156
thrownewERR_DNS_SET_SERVERS_FAILED(err,servers);

0 commit comments

Comments
(0)