Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created August 25, 2011 06:05
Show Gist options
  • Save ukstudio/1170083 to your computer and use it in GitHub Desktop.
Save ukstudio/1170083 to your computer and use it in GitHub Desktop.
require 'net/http'
uri = URI.parse('http://[::1]:3000')
puts uri.host #=> '[::1]'
puts uri.hostname #=> '::1'
Net::HTTP.start(uri.host, uri.port) do |http|
http.get('/')
end #=> getaddrinfo: Name or 2 vice not known (SocketError)
Net::HTTP.start(uri.hostname, uri.port) do |http|
http.get('/')
end #=> #<Net::HTTPOK..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment