Feature #17219 ยป 3635.patch
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
|
||