tldts-icann 7.4.15 → 7.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +10 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/es6/tsconfig.bundle.tsbuildinfo +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +11 -12
package/dist/cjs/index.js
CHANGED
|
@@ -245,11 +245,11 @@ function extractHostname(url, urlIsValidHostname, validate = false) {
|
|
|
245
245
|
// a control char means it was split by a tab/newline (strip + re-parse).
|
|
246
246
|
for (let i = start; i < indexOfProtocol; i += 1) {
|
|
247
247
|
const code = url.charCodeAt(i) | 32;
|
|
248
|
-
if (!((
|
|
248
|
+
if (!((code >= 97 && code <= 122) || // [a, z]
|
|
249
249
|
(code >= 48 && code <= 57) || // [0, 9]
|
|
250
250
|
code === 46 || // '.'
|
|
251
251
|
code === 45 || // '-'
|
|
252
|
-
code === 43
|
|
252
|
+
code === 43 // '+'
|
|
253
253
|
)) {
|
|
254
254
|
const raw = url.charCodeAt(i);
|
|
255
255
|
if (raw === 9 || raw === 10 || raw === 13) {
|
|
@@ -397,7 +397,10 @@ function extractHostname(url, urlIsValidHostname, validate = false) {
|
|
|
397
397
|
if (validate && start < end) {
|
|
398
398
|
// First-char rule: must be a valid host char, '.', or '_' (NOT '-').
|
|
399
399
|
const c0 = url.charCodeAt(start);
|
|
400
|
-
if (
|
|
400
|
+
if (
|
|
401
|
+
// Keep these parens: they scope /*@__INLINE__*/ for terser.
|
|
402
|
+
// prettier-ignore
|
|
403
|
+
!(
|
|
401
404
|
/*@__INLINE__*/ (isValidHostnameChar(c0) ||
|
|
402
405
|
c0 === 46 /* '.' */ ||
|
|
403
406
|
c0 === 95 /* '_' */)) ||
|
|
@@ -578,9 +581,9 @@ function isProbablyIpv6(hostname) {
|
|
|
578
581
|
if (code === 58 /* ':' */) {
|
|
579
582
|
hasColon = true;
|
|
580
583
|
}
|
|
581
|
-
else if (!((
|
|
584
|
+
else if (!((code >= 48 && code <= 57) || // 0-9
|
|
582
585
|
(code >= 97 && code <= 102) || // a-f
|
|
583
|
-
(code >= 65 && code <= 70)
|
|
586
|
+
(code >= 65 && code <= 70) // A-F (RFC 4291 §2.2: an IPv6 hextet is hex digits only)
|
|
584
587
|
)) {
|
|
585
588
|
return false;
|
|
586
589
|
}
|
|
@@ -716,6 +719,8 @@ function isValidHostname (hostname) {
|
|
|
716
719
|
}
|
|
717
720
|
else if (
|
|
718
721
|
// A forbidden character in the label...
|
|
722
|
+
// Keep these parens: they scope /*@__INLINE__*/ for terser.
|
|
723
|
+
// prettier-ignore
|
|
719
724
|
!( /*@__INLINE__*/(isValidAscii(code) || code === 45 || code === 95)) ||
|
|
720
725
|
// ...or a '-' starting a label (the byte right after a '.'). A label must
|
|
721
726
|
// not begin with a hyphen (RFC 1034 §3.5 / RFC 1035 §2.3.1 LDH, as amended
|