summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/url.js2
-rw-r--r--test/parallel/test-url.js15
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/url.js b/lib/url.js
index 6ffec081f6..7db23bf48a 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -413,7 +413,7 @@ function validateHostname(self, rest, hostname) {
}
// Invalid host character
self.hostname = hostname.slice(0, i);
- if (i < hostname.length - 1)
+ if (i < hostname.length)
return '/' + hostname.slice(i) + rest;
break;
}
diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js
index 9aa2682cbc..760303e98b 100644
--- a/test/parallel/test-url.js
+++ b/test/parallel/test-url.js
@@ -851,6 +851,21 @@ var parseTests = {
pathname: '/:npm/npm',
path: '/:npm/npm',
href: 'git+ssh://git@github.com/:npm/npm'
+ },
+
+ 'https://*': {
+ protocol: 'https:',
+ slashes: true,
+ auth: null,
+ host: '',
+ port: null,
+ hostname: '',
+ hash: null,
+ search: null,
+ query: null,
+ pathname: '/*',
+ path: '/*',
+ href: 'https:///*'
}
};