URI with a literal IPv6 address needs to have a pair of brackets, [ and ], according to RFC 2732. However, the uri library doesn't add the brackets:
$ irb
⢀⡴⠊⢉⡟⢿ IRB v1.18.0 - Ruby 4.0.3
⣎⣀⣴⡋⡟⣻ Type "help" for commands, "help <cmd>" for details
⣟⣼⣱⣽⣟⣾ ~/c/src/local/rk26-code-party
> require 'uri'
> s = URI::Generic.new('https', nil, '::1', 443, nil, '/', nil, nil, nil).to_s
=> "https://::1:443/"
and makes it impossible to be parsed:
> URI.parse(s)
.../4.0.3/lib/ruby/4.0.0/uri/rfc3986_parser.rb:130:in 'URI::RFC3986_Parser#split': bad URI (is not URI?): "https://::1:443/" (URI::InvalidURIError)
Might it be necessary to add a pair of brackets when the host part is a literal IPv6 address?
URI with a literal IPv6 address needs to have a pair of brackets,
[and], according to RFC 2732. However, the uri library doesn't add the brackets:and makes it impossible to be parsed:
Might it be necessary to add a pair of brackets when the host part is a literal IPv6 address?