Skip to content

Commit d85e1f0

Browse files
committed
dns: use url module instead of punycode for IDNA
PR-URL: #35091 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 26eed3e commit d85e1f0

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

‎doc/api/intl.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ option:
5151
|`String.prototype.toLocale*Case()`| partial (not locale-aware) | full | full | full |
5252
|[`Number.prototype.toLocaleString()`][]| partial (not locale-aware) | partial/full (depends on OS) | partial (English-only) | full |
5353
|`Date.prototype.toLocale*String()`| partial (not locale-aware) | partial/full (depends on OS) | partial (English-only) | full |
54+
|[Legacy URL Parser][]| partial (no IDN support) | full | full | full |
5455
|[WHATWG URL Parser][]| partial (no IDN support) | full | full | full |
5556
|[`require('buffer').transcode()`][]| none (function does not exist) | full | full | full |
5657
|[REPL][]| partial (inaccurate line editing) | full | full | full |
@@ -193,6 +194,7 @@ to be helpful:
193194
[ECMA-262]: https://tc39.github.io/ecma262/
194195
[ECMA-402]: https://tc39.github.io/ecma402/
195196
[ICU]: http://site.icu-project.org/
197+
[Legacy URL parser]: url.md#url_legacy_url_api
196198
[REPL]: repl.md#repl_repl
197199
[Test262]: https://github.com/tc39/test262/tree/HEAD/test/intl402
198200
[WHATWG URL parser]: url.md#url_the_whatwg_url_api

‎lib/internal/idna.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ if (internalBinding('config').hasIntl){
44
const{ toASCII, toUnicode }=internalBinding('icu');
55
module.exports={ toASCII, toUnicode };
66
}else{
7-
const{toASCII, toUnicode}=require('punycode');
8-
module.exports={ toASCII, toUnicode };
7+
const{domainToASCII, domainToUnicode}=require('internal/url');
8+
module.exports={toASCII: domainToASCII,toUnicode: domainToUnicode};
99
}

‎test/parallel/test-bootstrap-modules.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ if (!common.isMainThread){
151151
if(common.hasIntl){
152152
expectedModules.add('Internal Binding icu');
153153
}else{
154-
expectedModules.add('NativeModule punycode');
154+
expectedModules.add('NativeModule url');
155155
}
156156

157157
if(process.features.inspector){

‎test/parallel/test-url-format.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
'use strict';
2-
require('../common');
2+
constcommon=require('../common');
33
constassert=require('assert');
44
consturl=require('url');
55

6+
if(!common.hasIntl)
7+
common.skip('missing Intl');
8+
69
// Formatting tests to verify that it'll format slightly wonky content to a
710
// valid URL.
811
constformatTests={

‎test/parallel/test-url-parse-format.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
2-
require('../common');
2+
constcommon=require('../common');
3+
4+
if(!common.hasIntl)
5+
common.skip('missing Intl');
6+
37
constassert=require('assert');
48
constinspect=require('util').inspect;
59

0 commit comments

Comments
(0)