Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1dad19b

Browse filesBrowse files
Trottrvagg
authored andcommitted
test: remove valid hostname check in test-dns.js
Operating systems can and do return invalid hostnames if that's what they have (for example) in /etc/hosts. Test passes if no error is thrown and the hostname string is not empty. Fixes: #2468 PR-URL: #2785 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 5e93bc4 commit 1dad19b
Copy full SHA for 1dad19b

File tree

Expand file treeCollapse file tree

2 files changed

+4
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-11
lines changed
Open diff view settings
Collapse file

‎test/common.js‎

Copy file name to clipboardExpand all lines: test/common.js
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,6 @@ exports.hasMultiLocalhost = function hasMultiLocalhost() {
436436
return ret === 0;
437437
};
438438

439-
exports.isValidHostname = function(str) {
440-
// See http://stackoverflow.com/a/3824105
441-
var re = new RegExp(
442-
'^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])' +
443-
'(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$');
444-
445-
return !!str.match(re) && str.length <= 255;
446-
};
447-
448439
exports.fileExists = function(pathname) {
449440
try {
450441
fs.accessSync(pathname);
Collapse file

‎test/internet/test-dns.js‎

Copy file name to clipboardExpand all lines: test/internet/test-dns.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ TEST(function test_lookup_all_mixed(done) {
575575
TEST(function test_lookupservice_ip_ipv4(done) {
576576
var req = dns.lookupService('127.0.0.1', 80, function(err, host, service) {
577577
if (err) throw err;
578-
assert.ok(common.isValidHostname(host));
578+
assert.equal(typeof host, 'string');
579+
assert(host);
579580

580581
/*
581582
* Retrieve the actual HTTP service name as setup on the host currently
@@ -604,7 +605,8 @@ TEST(function test_lookupservice_ip_ipv4(done) {
604605
TEST(function test_lookupservice_ip_ipv6(done) {
605606
var req = dns.lookupService('::1', 80, function(err, host, service) {
606607
if (err) throw err;
607-
assert.ok(common.isValidHostname(host));
608+
assert.equal(typeof host, 'string');
609+
assert(host);
608610

609611
/*
610612
* Retrieve the actual HTTP service name as setup on the host currently

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.