return ret === 0;
};
-exports.isValidHostname = function(str) {
- // See http://stackoverflow.com/a/3824105
- var re = new RegExp(
- '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])' +
- '(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$');
-
- return !!str.match(re) && str.length <= 255;
-};
-
exports.fileExists = function(pathname) {
try {
fs.accessSync(pathname);
TEST(function test_lookupservice_ip_ipv4(done) {
var req = dns.lookupService('127.0.0.1', 80, function(err, host, service) {
if (err) throw err;
- assert.ok(common.isValidHostname(host));
+ assert.equal(typeof host, 'string');
+ assert(host);
/*
* Retrieve the actual HTTP service name as setup on the host currently
TEST(function test_lookupservice_ip_ipv6(done) {
var req = dns.lookupService('::1', 80, function(err, host, service) {
if (err) throw err;
- assert.ok(common.isValidHostname(host));
+ assert.equal(typeof host, 'string');
+ assert(host);
/*
* Retrieve the actual HTTP service name as setup on the host currently