🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

fast-uri

Package Overview
Dependencies
Maintainers
11
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-uri - npm Package Compare versions

Comparing version
2.4.1
to
2.4.2
+1
-1
index.js

@@ -270,3 +270,3 @@ 'use strict'

try {
parsed.host = URL.domainToASCII(parsed.host.toLowerCase())
parsed.host = new URL('http://' + parsed.host).hostname
} catch (e) {

@@ -273,0 +273,0 @@ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e

{
"name": "fast-uri",
"description": "Dependency free RFC 3986 URI toolbox",
"version": "2.4.1",
"version": "2.4.2",
"main": "index.js",

@@ -6,0 +6,0 @@ "type": "commonjs",

@@ -135,1 +135,29 @@ 'use strict'

})
test('parse canonicalises IDN / Unicode hosts to their ASCII form', (t) => {
const cases = [
{
input: 'http://127。0。0。1/',
expectedHost: '127.0.0.1',
description: 'full-width ideographic stops as octet separators'
},
{
input: 'http://example.com/',
expectedHost: 'example.com',
description: 'fullwidth e as first letter'
},
{
input: 'http://納豆.example.org/',
expectedHost: 'xn--99zt52a.example.org',
description: 'CJK label requiring punycode'
}
]
t.plan(cases.length * 2)
cases.forEach(({ input, expectedHost, description }) => {
const parsed = fastURI.parse(input)
t.notOk(parsed.error, `parse should not set error: ${description}`)
t.equal(parsed.host, expectedHost, `host canonicalised to ASCII: ${description}`)
})
})