SocketError: getaddrinfo: nodename nor servname provided, or

I'm trying to use Net/Http and am getting the following error:

SocketError: getaddrinfo: nodename nor servname provided, or not known

I'm on Mac OS X, Leopard, check out my ruby version/gem env below.

Also, I double checked my etc/hosts and I do see an entry for
localhost/127.0.0.1 there. Seems like this is a Leopard issue?

[baq@baq:~]$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]

[baq@baq:~]$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.0.1 (1.0.1)
  - RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111)
[universal-darwin9.0]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
  - RUBYGEMS PREFIX:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby
  - RUBY EXECUTABLE:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-9
  - GEM PATHS:

···

-
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
     - /Library/Ruby/Gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
--
Posted via http://www.ruby-forum.com/.

Can we pleas see the code that is causing this error?

···

--
Posted via http://www.ruby-forum.com/.

Here's the code:

require 'net/http'
Net::HTTP.start('http://www.google.com') do |http|
  response = http.get('/')
  puts response
end

···

--
Posted via http://www.ruby-forum.com/.

Try this:

require 'net/http'
Net::HTTP.start('www.google.com') do |http|
  response = http.get('/')
  puts response
end

#start doesn't take the protocol.

···

--
Posted via http://www.ruby-forum.com/.

Great, that did it!

Thanks Michael! (and I apologize to everyone who was spammed with this
message--I *did* do a google search & doc search but couldn't find a
solution...)

Michael Boutros wrote:

···

Try this:

require 'net/http'
Net::HTTP.start('www.google.com') do |http|
  response = http.get('/')
  puts response
end

#start doesn't take the protocol.

--
Posted via http://www.ruby-forum.com/\.