rest-client/rest-client — pull request #332 by jrafanie (2014-11-19 21:02:11+00:00)
Title: Use URI::Generic#hostname to strip brackets from ipv6 hosts

URI::Generic#host is not appropriate to pass socket methods such as TCPSocket.open.

See: https://bugs.ruby-lang.org/issues/3788
From above, URI::Generic#hostname was added in ruby 1.9.3.

From: lib/uri/common.rb:

Since IPv6 addresses are wrapped by brackets in URIs,
this method returns IPv6 addresses wrapped by brackets.
This form is not appropriate to pass socket methods such as TCPSocket.open.
If unwrapped host names are required, use "hostname" method.

URI("http://[::1]/bar/baz").host #=> "[::1]"
URI("http://[::1]/bar/baz").hostname #=> "::1"

See also: nahi/httpclient#176