drbrain / net-http-persistent

Thread-safe persistent connections with Net::HTTP
http://seattlerb.rubyforge.org/net-http-persistent
339 stars 117 forks source link

Support IPv6 URIs #82

Closed foca closed 5 years ago

foca commented 8 years ago

Instead of using URI::Generic#host, we should use #hostname. The only difference between these methods is that #hostname will unwrap brackets from URIs that look like literal IPv6 addresses.

I don't know how to test this, however, short of booting up a webrick instance and actually making requests, but that seems a bit overkill.

See https://github.com/lostisland/faraday/pull/621 for more background.

drbrain commented 8 years ago

It looks like there isn't enough infrastructure to test this right now, you'd want to assert that the value passed in here is the correct IPv6 hostname, but there's no tests for that class.

I can add tests.

You may want to update the tests to use @uri.hostname (even though they don't use a URI with an IPv6 address).