diff options
author | Timothy Gu <timothygu99@gmail.com> | 2017-05-31 17:13:43 -0700 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2017-06-06 23:33:56 -0700 |
commit | 91a1bbe3055a660194ca4d403795aa0c03e9d056 (patch) | |
tree | 5fdfb031e9bf7fe6db7eba6ec54c9181fa42e111 /src/node_i18n.h | |
parent | 60d14c870274e9f193a81e8eb9b6a74fba3b4178 (diff) | |
download | node-new-91a1bbe3055a660194ca4d403795aa0c03e9d056.tar.gz |
url: update IDNA handling
Remove custom tests for invalid IDNA domains in url-idna.js in favor of
the more comprehensive official set.
PR-URL: https://github.com/nodejs/node/pull/13362
Refs: https://github.com/whatwg/url/pull/309
Refs: https://github.com/w3c/web-platform-tests/pull/5976
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'src/node_i18n.h')
-rw-r--r-- | src/node_i18n.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/node_i18n.h b/src/node_i18n.h index cc1f3e6ea5..adf9feb414 100644 --- a/src/node_i18n.h +++ b/src/node_i18n.h @@ -37,10 +37,26 @@ namespace i18n { bool InitializeICUDirectory(const std::string& path); +enum idna_mode { + // Default mode for maximum compatibility. + IDNA_DEFAULT, + // Ignore all errors in IDNA conversion, if possible. + IDNA_LENIENT, + // Enforce STD3 rules (UseSTD3ASCIIRules) and DNS length restrictions + // (VerifyDnsLength). Corresponds to `beStrict` flag in the "domain to ASCII" + // algorithm. + IDNA_STRICT +}; + +// Implements the WHATWG URL Standard "domain to ASCII" algorithm. +// https://url.spec.whatwg.org/#concept-domain-to-ascii int32_t ToASCII(MaybeStackBuffer<char>* buf, const char* input, size_t length, - bool lenient = false); + enum idna_mode mode = IDNA_DEFAULT); + +// Implements the WHATWG URL Standard "domain to Unicode" algorithm. +// https://url.spec.whatwg.org/#concept-domain-to-unicode int32_t ToUnicode(MaybeStackBuffer<char>* buf, const char* input, size_t length); |