From 0b87b1a0958c88ed08b8232ae1e443d0317115fa Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 20 Sep 2016 12:02:54 +0200 Subject: [PATCH] dns: tweak regex for IPv6 addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Ilkka Myller Reviewed-By: James M Snell Reviewed-By: Prince John Wesley Reviewed-By: Michaƫl Zasso --- lib/dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns.js b/lib/dns.js index d577023b50c440..0aeffca03b93a2 100644 --- a/lib/dns.js +++ b/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) {