Project

General

Profile

Feature #17219 ยป 3635.patch

Patch for URI#hostname(=) - lzap (Lukas Zapletal), 10/07/2020 08:38 AM

View differences:

lib/uri/generic.rb
#
def hostname
v = self.host
/\A\[(.*)\]\z/ =~ v ? $1 : v
v[0] == '[' && v.length > 2 && v[-1] == ']' ? v[1..-2] : v
end
# Sets the host part of the URI as the argument with brackets for IPv6 addresses.
......
# it is wrapped with brackets.
#
def hostname=(v)
v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v
v = "[#{v}]" if v.index(':') && v[0] != '[' && v[-1] != ']'
self.host = v
end
    (1-1/1)