Browse Source

dns: tweak regex for IPv6 addresses

The regex used in `dns.setServers()` to match IPv6 addresses in square
brackets uses a capturing group for the port but this info is not
needed.

This commit replaces the capturing group with a non capturing one.

Ref: https://github.com/nodejs/node/pull/8965
PR-URL: https://github.com/nodejs/node/pull/8665
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
v4.x
Luigi Pinca 9 years ago
committed by Myles Borins
parent
commit
0b87b1a095
  1. 2
      lib/dns.js

2
lib/dns.js

@ -292,7 +292,7 @@ exports.setServers = function(servers) {
if (ver)
return newSet.push([ver, serv]);
var match = serv.match(/\[(.*)\](:\d+)?/);
var match = serv.match(/\[(.*)\](?::\d+)?/);
// we have an IPv6 in brackets
if (match) {

Loading…
Cancel
Save