Open-uri problem

I have changed the production server (debian, ruby 1.8.5 ) of one of
my apps, and a script I was running doesn’t work anymore.

Basically the script tries to open a web page. Something like this:

require ‘rubygems’
require ‘open-uri’

open(“”) {|f|
f.each_line {|line| p line}

The error it returns, for every page I’ve tried, is:

/usr/lib/ruby/1.8/net/http.rb:560:in `initialize’: Connection refused

  • connect(2) (Errno::ECONNREFUSED)
    from /usr/lib/ruby/1.8/net/http.rb:560:in open' from /usr/lib/ruby/1.8/net/http.rb:560:inconnect’
    from /usr/lib/ruby/1.8/timeout.rb:48:in timeout' from /usr/lib/ruby/1.8/timeout.rb:76:intimeout’
    from /usr/lib/ruby/1.8/net/http.rb:560:in connect' from /usr/lib/ruby/1.8/net/http.rb:553:indo_start’
    from /usr/lib/ruby/1.8/net/http.rb:542:in start' from /usr/lib/ruby/1.8/open-uri.rb:242:inopen_http’
    from /usr/lib/ruby/1.8/open-uri.rb:616:in buffer_open' from /usr/lib/ruby/1.8/open-uri.rb:164:inopen_loop’
    from /usr/lib/ruby/1.8/open-uri.rb:162:in catch' from /usr/lib/ruby/1.8/open-uri.rb:162:inopen_loop’
    from /usr/lib/ruby/1.8/open-uri.rb:132:in open_uri' from /usr/lib/ruby/1.8/open-uri.rb:518:inopen’
    from /usr/lib/ruby/1.8/open-uri.rb:30:in `open’

What can it be? I haven’t found a lot of infos on this error, so every
hint (firewall problem? bug in the ruby version?.. ) is appreciated.

Maybe your web proxy locally refuses to connect, or maybe
your app want to connect using local proxy like or 8080, this web has the same trouble with you :

Maybe you can crosscheck to web above. Good Luck.


FREE eBook for Ruby:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs