HTTP request error: name or service not known

I am trying to make HTTP requests via Ruby. When running the following code:

require "net/http"
require "uri"

uri = URI.parse("")

# Will print response.body

I get the following error:

SocketError: initialize: name or service not known
        from org/jruby/ext/socket/ `initialize'
        from org/jruby/ `open'
        from c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:762:in `connect'
        from org/jruby/ext/timeout/ `timeout'
        from c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:762:in `connect'
        from c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:755:in `do_start'
        from c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:744:in `start'
        from c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:454:in `get_response'
        from c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:412:in `get_print'
        from (irb):29:in `evaluate'
        from org/jruby/ `eval'
        from org/jruby/ `loop'
        from org/jruby/ `catch'
        from org/jruby/ `catch'
        from c:/jruby-1.7.3/bin/irb:13:in `(root)'

This is probably proxy related, but I am not sure. How can I fix this problem?


Ruby will automatically use the HTTP proxy as specified in your environment variables.

EXPORT http_proxy=
ruby your_http_script.rb

Same thing happened to me. No proxy was in use.

The reason was that I was not running as root and /etc/resolv.conf didn't have read permissions to anyone other than root. Adding read permissions solved the host resolving problem.

Need Your Help

Finalizer launched while its object was still being used

c# .net garbage-collection finalization

Summary: C#/.NET is supposed to be garbage collected. C# has a destructor, used to clean resources. What happen when an object A is garbage collected the same line I try to clone one of its variable

Jet creator music - EAS synth.dll

java android multimedia

I am trying to use the JET music player in Android to create music for my game. I am having trouble installing the eas synth plugin for Sonar 7 which I will use to edit the midi tracks.