summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
authorJohannLai <johann_lai@outlook.com>2020-07-17 00:08:29 +0800
committerGitHub <noreply@github.com>2020-07-16 12:08:29 -0400
commitd60f9c2549c7dfb0fbd6c9c8984c215f5dd75e76 (patch)
tree54868ba9873932337754be35b77707d145d1a44c /cli/js
parentde3416689175214f33b226d4c510da63737c0db9 (diff)
fix(cli/js/web): IPv6 hostname should be compressed (#6772)
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/web/url.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts
index f466f9583..fabef3329 100644
--- a/cli/js/web/url.ts
+++ b/cli/js/web/url.ts
@@ -565,7 +565,8 @@ function encodeHostname(s: string, isSpecial = true): string {
if (!s.match(/^\[[0-9A-Fa-f.:]{2,}\]$/)) {
throw new TypeError("Invalid hostname.");
}
- return s.toLowerCase();
+ // IPv6 address compress
+ return s.toLowerCase().replace(/\b:?(?:0+:?){2,}/, "::");
}
let result = s;