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

Diff for: doc/api/intl.md

+2
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

Diff for: lib/internal/idna.js

+2-2
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
}

Diff for: test/parallel/test-bootstrap-modules.js

+1-1
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) {

Diff for: test/parallel/test-url-format.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44
const url = 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
const formatTests = {

Diff for: test/parallel/test-url-parse-format.js

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

0 commit comments

Comments
 (0)