Extended Hostname Validation

Examples:

Objects and Endpoints:

Object: Hostname

Hostname
Supports:
print
Object: Print

Example

"print": {
	"unicode": "😻.😻.😻",
	"idna": "xn--238h.xn--238h.xn--238h",
	"percent-encoded": "%F0%9F%98%BB.%F0%9F%98%BB.%F0%9F%98%BB"
}
labels
[]Object: Label

Example

"labels": [
	{
		"print": {
			"unicode": "😻"
		},
		"encoding": {
			"unicode": true,
			"idna-excluded": true
		},
		"delimiter": 2,
		"correct": true
	},
	{
		"print": {
			"unicode": "😻"
		},
		"encoding": {
			"idna": true,
			"idna-excluded": true
		},
		"delimiter": 4,
		"correct": true
	},
	{
		"print": {
			"unicode": "😻"
		},
		"encoding": {
			"pe-necessary": true,
			"idna-excluded": true
		},
		"correct": true
	}
]
tld
Boolean
Is the entirety of the Hostname a TLD?

Single Labels are considered a TLD
Hexadecimal, Decimals, and Octals are Invalid, are not TLDs!

Example

"tld": false
tld-invalid
Boolean
Is the TLD Invalid for Personal Use?

Hexadecimal, Decimals, and Octals are Invalid, they conflict with IP Addresses!

Example

"tld-invalid": false
tld-real
Boolean
Does this Hostname contain a real TLD?

Example

"tld-real": false
tld-root
Boolean
Does this Hostname have a Root Server TLD?

Root Server TLDs are A-Z and are NOT single Unicode characters
Hexadecimal, Decimals, and Octals are Invalid, are not TLDs!

Example

"tld-root": false
tld-pos
Number
Does this Hostname contain a real TLD, and if so what is the Label Position of the starting TLD?

If Hostname does not contain a real TLD, POS is -1
If the tld-pos Option is disabled, POS is -2 to differentiate results

www.juandefu.ca would return 2
juandefu.ca would return 1
ca would return 0
faketld would return -1

Example

"tld-pos": -1
email-toolong
Boolean
Is this Hostname Longer than the Email RFC Allows?

Hostnames are allowed to be up to 255 characters.
Emails are allowed to be up to 254 characters. Email Hostnames are allowed to be up to 252 characters.

Example

"email-toolong": false
dangerous
Boolean
Is this Potentially Dangerous?

Example

"dangerous": false
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true
correct-email
Boolean
Was Input Correct to the Email Spec?

Example

"correct-email": true

Object Examples: Hostname

Invalid TLD Input: "0"
{
	"print": {
		"unicode": "0",
		"idna": "0",
		"percent-encoded": "0"
	},
	"labels": [
		{
			"print": {
				"unicode": "0"
			},
			"encoding": {},
			"correct": true
		}
	],
	"dangerous": true,
	"tld-invalid": true,
	"tld-pos": -1
}
ASCII Input: "www.juandefu.ca"
{
	"print": {
		"unicode": "www.juandefu.ca",
		"idna": "www.juandefu.ca",
		"percent-encoded": "www.juandefu.ca"
	},
	"labels": [
		{
			"print": {
				"unicode": "www"
			},
			"encoding": {},
			"delimiter": 1,
			"correct": true
		},
		{
			"print": {
				"unicode": "juandefu"
			},
			"encoding": {},
			"delimiter": 1,
			"correct": true
		},
		{
			"print": {
				"unicode": "ca"
			},
			"encoding": {},
			"correct": true
		}
	],
	"correct": true,
	"correct-email": true,
	"tld-real": true,
	"tld-pos": 2
}
Unicode.IDNA.PercentEncoded UTS #46 Delimiters Input: "πŸ˜»γ€‚xn--238hq%F0%9F%98%BB"
{
	"print": {
		"unicode": "😻.😻.😻",
		"idna": "xn--238h.xn--238h.xn--238h",
		"percent-encoded": "%F0%9F%98%BB.%F0%9F%98%BB.%F0%9F%98%BB"
	},
	"labels": [
		{
			"print": {
				"unicode": "😻"
			},
			"encoding": {
				"unicode": true,
				"idna-excluded": true
			},
			"delimiter": 2,
			"correct": true
		},
		{
			"print": {
				"unicode": "😻"
			},
			"encoding": {
				"idna": true,
				"idna-excluded": true
			},
			"delimiter": 4,
			"correct": true
		},
		{
			"print": {
				"unicode": "😻"
			},
			"encoding": {
				"pe-necessary": true,
				"idna-excluded": true
			},
			"correct": true
		}
	],
	"tld-pos": -1
}

Object: Hostname_Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
print
Object: Print_Options
labels
Object: Label_Options
tld
Boolean
tld-invalid
Boolean
tld-real
Boolean
tld-root
Boolean
tld-pos
Boolean
email-toolong
Boolean
dangerous
Boolean
correct
Boolean
correct-email
Boolean

Object Examples: Hostname_Options

Default Options:
{
	"print": {
		"unicode": true,
		"idna": true,
		"percent-encoded": true
	},
	"labels": {
		"print": {
			"unicode": true,
			"idna": false,
			"percent-encoded": false
		},
		"encoding": {
			"cleaned": true,
			"unicode": true,
			"pe-necessary": true,
			"pe-unnecessary": true,
			"pe-partial": true,
			"idna": true,
			"idna-invalid": true,
			"idna-normalized": true,
			"idna-normalize-failed": true,
			"idna-excluded": true
		},
		"delimiter": true,
		"correct": true
	},
	"email-toolong": true,
	"dangerous": true,
	"correct": true,
	"correct-email": true,
	"tld": true,
	"tld-invalid": true,
	"tld-real": true,
	"tld-root": true,
	"tld-pos": true
}

Object: Label

Label

print
Object: Print

Example

"print": {
	"unicode": "😻",
	"idna": "xn--238h",
	"percent-encoded": "%F0%9F%98%BB"
}
encoding
Object: Encoding

Example

"encoding": {
	"unicode": true,
	"idna-excluded": true
}
delimiter
Number
UTS #46 Delimiter.
This is the Delimiter that came after the current label!

"A.B"
A has the . Delimiter: 1
B has no Delimiter: 0


Constants

Key Value
0 No Delimiter
1 U+002E ( . ) FULL STOP
2 U+3002 ( 。 ) IDEOGRAPHIC FULL STOP
3 U+FF0E ( . ) FULLWIDTH FULL STOP
4 U+FF61 ( q ) HALFWIDTH IDEOGRAPHIC FULL STOP


Example

"delimiter": 1 // .
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true

Object Examples: Label

Invalid TLD Input: "0"
{
	"print": {
		"unicode": "0"
	},
	"encoding": {},
	"correct": true
}
Root TLD Input: "a.x"
{
	"print": {
		"unicode": "a"
	},
	"encoding": {},
	"delimiter": 1,
	"correct": true
}
Country Code TLD Input: "ca。x"
{
	"print": {
		"unicode": "ca"
	},
	"encoding": {},
	"delimiter": 2,
	"correct": true
}
ASCII Input: "juandefu.x"
{
	"print": {
		"unicode": "juandefu"
	},
	"encoding": {},
	"delimiter": 3,
	"correct": true
}
Unicode Input: "😻qx"
{
	"print": {
		"unicode": "😻"
	},
	"encoding": {
		"unicode": true,
		"idna-excluded": true
	},
	"delimiter": 4,
	"correct": true
}

Object: Label_Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
print
Object: Print_Options
encoding
Object: Encoding_Options
delimiter
Boolean
correct
Boolean

Object: Print

Hostname and Label both use this Object for Printing

uri
String
URI Output

Unicode and Unsafe ASCII Characters are Percent Encoded

Example

"uri": "ascii"
"uri": "%25" // ascii % character
"uri": "%F0%9F%98%BB" // 😻
iri
String
IRI Output

Unicode is Unencoded, Unsafe ASCII Characters are Percent Encoded

Example

"iri": "unicode"
"iri": "%25" // ascii % character
"iri": "😻"
percent-encoded
String
Percent Encoded Output

Example

"percent-encoded": "output"
"percent-encoded": "%F0%9F%98%BB"

Object Examples: Print

ASCII Input: "juandefu.ca"
{
	"unicode": "juandefu.ca",
	"idna": "juandefu.ca",
	"percent-encoded": "juandefu.ca"
}
ASCII Input: "a-b-c"
{
	"unicode": "a-b-c",
	"idna": "a-b-c",
	"percent-encoded": "a-b-c"
}
Unicode.IDNA.PercentEncoded Input: "😻.xn--238h.%F0%9F%98%BB"
{
	"unicode": "😻.😻.😻",
	"idna": "xn--238h.xn--238h.xn--238h",
	"percent-encoded": "%F0%9F%98%BB.%F0%9F%98%BB.%F0%9F%98%BB"
}

Object: Print_Options

Hostname and Label both use this Object for Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
unicode
Boolean
idna
Boolean
percent-encoded
Boolean

Object: Encoding

cleaned
Boolean
Was the Input Cleaned?
Control Character or other Blacklisted Characters may be removed!

Example

"cleaned": false
unicode
Boolean
Did the Input contain Unicode?

Example

"unicode": true
pe-necessary
Boolean
Did the Input contain Percent Encoding - was a Character Necessarily Encoded?

Example

"pe-necessary": false
pe-unnecessary
Boolean
Did the Input contain Percent Encoding - was a Character Unnecessarily Encoded?

Example

"pe-unnecessary": false
pe-partial
Boolean
Did the Input contain Percent Encoding - was a Unicode Character Partially Encoded?

Example

"pe-partial": false
idna
Boolean
Was the Input IDNA Encoded?

Example

"unicode": true
idna-invalid
Boolean
Was the Input an Invalid IDNA Label?

Example

"idna-invalid": false
idna-normalized
Boolean
Was the Input UTS #46 Normalized?

Example

"idna-normalized": true
idna-normalize-failed
Boolean
Did Input contain a Disallowed or Invalid UTS #46 Character?

Example

"idna-normalize-failed": false
idna-excluded
Boolean
Does the Input contain a UTS #46 Character that is Excluded from use with IDNA 2008?

Example

"idna-excluded": false

Object Examples: Encoding

ASCII Input: "juandefu.ca"
{}
Unicode Input: "😻"
{
	"unicode": true,
	"idna-excluded": true
}
IDNA Input: "xn--238h"
{
	"idna": true,
	"idna-excluded": true
}
PercentEncoded Input: "%F0%9F%98%BB"
{
	"pe-necessary": true,
	"idna-excluded": true
}

Object: Encoding_Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
cleaned
Boolean
unicode
Boolean
pe-necessary
Boolean
pe-unnecessary
Boolean
pe-partial
Boolean
idna
Boolean
idna-invalid
Boolean
idna-normalized
Boolean
idna-normalize-failed
Boolean
idna-excluded
Boolean