Merge branch 'master' of github.com:elastic/elasticsearch-js into fix/leakingTimesInTransport

This commit is contained in:
spalger
2015-11-16 15:30:37 -06:00
5 changed files with 83 additions and 28 deletions

View File

@ -1,5 +1,7 @@
var _ = require('./utils');
var extractHostPartsRE = /\[\/*([^:]+):(\d+)\]/;
var extractHostPartsRE1x = /\[\/*([^:]+):(\d+)\]/;
var extractHostPartsRE = /^([\.:0-9a-f]*):([0-9]+)?$/;
function makeNodeParser(hostProp) {
return function (nodes) {
@ -10,8 +12,12 @@ function makeNodeParser(hostProp) {
var hostnameMatches = extractHostPartsRE.exec(node[hostProp]);
if (!hostnameMatches) {
throw new Error('node\'s ' + hostProp + ' property (' + JSON.stringify(node[hostProp]) +
') does not match the expected pattern ' + extractHostPartsRE + '.');
hostnameMatches = extractHostPartsRE1x.exec(node[hostProp]);
}
if (!hostnameMatches) {
throw new Error('expected node\'s ' + hostProp + ' property (' + JSON.stringify(node[hostProp]) +
') to match either ' + extractHostPartsRE + ' or ' + extractHostPartsRE1x + '.');
}
hosts.push({