Skip to content

Commit 311667b

Browse files
committed
url: ignore IDN errors when domainname have hyphens
There are valid domain names with hyphens at 3 and 4th position, new node WHATWG URL parser was failing for it assume its an invalid IDN. Also filters IDN errors when domain label start or end with hyphen. Fixes: #12965 Refs: https://www.icann.org/news/announcement-2000-01-07-en
1 parent 9dee867 commit 311667b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/node_i18n.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,8 @@ int32_t ToUnicode(MaybeStackBuffer<char>* buf,
472472
// 9.0.0 (rev. 17), but were found to be incompatible with many actual domain
473473
// names in the wild. As such, in the current UTS #46 draft (rev. 18) these
474474
// checks are made optional depending on the CheckHyphens flag, which will be
475-
// disabled in WHATWG URL's "domain to ASCII" algorithm as soon as the UTS #46
476-
// draft becomes standard.
475+
// disabled in WHATWG URL's "domain to unicode" algorithm as soon as the UTS
476+
// #46 draft becomes standard.
477477
// Refs:
478478
// - https://github.com/whatwg/url/issues/53
479479
// - http://www.unicode.org/review/pri317/

test/fixtures/url-idna.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ module.exports = {
204204
{
205205
ascii: 'sn-a5mlrn7s-.gevideo.com',
206206
unicode: 'sn-a5mlrn7s-.gevideo.com'
207+
},
208+
{
209+
ascii: '-sn-a5mlrn7s-.gevideo.com',
210+
unicode: '-sn-a5mlrn7s-.gevideo.com'
211+
},
212+
{
213+
ascii: '-sn--a5mlrn7s-.gevideo.com',
214+
unicode: '-sn--a5mlrn7s-.gevideo.com'
207215
}
208216
],
209217
invalid: [

0 commit comments

Comments
 (0)