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(“http://www.ruby-lang.org/”) {|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:in connect’
    from /usr/lib/ruby/1.8/timeout.rb:48:in timeout' from /usr/lib/ruby/1.8/timeout.rb:76:in timeout’
    from /usr/lib/ruby/1.8/net/http.rb:560:in connect' from /usr/lib/ruby/1.8/net/http.rb:553:in do_start’
    from /usr/lib/ruby/1.8/net/http.rb:542:in start' from /usr/lib/ruby/1.8/open-uri.rb:242:in open_http’
    from /usr/lib/ruby/1.8/open-uri.rb:616:in buffer_open' from /usr/lib/ruby/1.8/open-uri.rb:164:in open_loop’
    from /usr/lib/ruby/1.8/open-uri.rb:162:in catch' from /usr/lib/ruby/1.8/open-uri.rb:162:in open_loop’
    from /usr/lib/ruby/1.8/open-uri.rb:132:in open_uri' from /usr/lib/ruby/1.8/open-uri.rb:518:in open’
    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 ruby-lang.org, or maybe
your app want to connect ruby-lang.org using local proxy like
127.0.0.1:80 or 8080, this web has the same trouble with you :

Maybe you can crosscheck to web above. Good Luck.

Reinhart
http://teapoci.blogspot.com


FREE eBook for Ruby:
http://teapoci.blogspot.com/search/label/eBook