IPv6 addresses in URLs must be enclosed in square brackets.

Enhance your knowledge on Internet Protocol Version 6 with the IPv6 Test. Access flashcards and multiple-choice questions, each complete with hints and explanations. Prepare effectively for your exam!

Multiple Choice

IPv6 addresses in URLs must be enclosed in square brackets.

Explanation:
In URLs, when the host part is an IPv6 address, it must be placed inside square brackets. The reason is that IPv6 addresses contain colons, and the URL syntax uses colons to separate the host from the port number. Enclosing the address in brackets keeps the address distinct from the port separator, so the parser can correctly identify both parts. For example, http://[2001:db8::1]/path shows a bracketed IPv6 host, and if a port is used, http://[2001:db8::1]:8080/path keeps the port separate from the address. Without brackets, a URL like http://2001:db8::1/path would be ambiguous and invalid, because the colons inside the address would be mistaken for separators. Parentheses or curly braces aren’t recognized by the URL grammar for delimiting the host, and plain text without brackets would also be invalid in this position.

In URLs, when the host part is an IPv6 address, it must be placed inside square brackets. The reason is that IPv6 addresses contain colons, and the URL syntax uses colons to separate the host from the port number. Enclosing the address in brackets keeps the address distinct from the port separator, so the parser can correctly identify both parts. For example, http://[2001:db8::1]/path shows a bracketed IPv6 host, and if a port is used, http://[2001:db8::1]:8080/path keeps the port separate from the address. Without brackets, a URL like http://2001:db8::1/path would be ambiguous and invalid, because the colons inside the address would be mistaken for separators. Parentheses or curly braces aren’t recognized by the URL grammar for delimiting the host, and plain text without brackets would also be invalid in this position.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy