require ''rss/1.0'' require ''rss/2.0'' require ''open-uri'' source = "something.com" # url or local file content = "" # raw content of url will be loaded here open(source,:proxy => nil) do |s| content = s.read end rss = RSS::Parser.parse(content, false) puts "Root values" print "RSS title: ", rss.channel.title, "\n" ############################################## Now, running this code through IRB works fine and gives me correct result. Whereas, If I run same piece of code through WEBRICK server, it gives me following error ... ------------------------------------------------------------------------------------------------------------------ OpenSSL::SSL::SSLError in Document#feed SSL_CTX_new:: library has no ciphers RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `new'' D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `initialize'' D:/ruby/lib/ruby/1.8/net/http.rb:430:in `open'' D:/ruby/lib/ruby/1.8/net/http.rb:430:in `do_start'' D:/ruby/lib/ruby/1.8/net/http.rb:419:in `start'' D:/ruby/lib/ruby/1.8/net/http.rb:821:in `request'' D:/ruby/lib/ruby/1.8/net/http.rb:615:in `get'' ------------------------------------------------------------------------------------------------------------------ Any clue ?? Is it something to do with SSL certification ? Thanks, Karika Shah
Tom Z Meinlschmidt
2009-May-06 23:49 UTC
Re: open call works fine in irb but not through webrick server
irb != rails so try this script via script/console irb is interactive ruby console, so libraries etc could be different for ruby and for rails if this will work in script/console, then it will work via mongrel/webrick as well tm Karika wrote:> require ''rss/1.0'' > require ''rss/2.0'' > require ''open-uri'' > > source = "something.com" # url or local file > content = "" # raw content of url will be loaded here > open(source,:proxy => nil) do |s| content = s.read end > rss = RSS::Parser.parse(content, false) > > puts "Root values" > print "RSS title: ", rss.channel.title, "\n" > ############################################## > Now, running this code through IRB works fine and gives me correct > result. > Whereas, If I run same piece of code through WEBRICK server, it gives > me following error ... > > ------------------------------------------------------------------------------------------------------------------ > OpenSSL::SSL::SSLError in Document#feed > SSL_CTX_new:: library has no ciphers > RAILS_ROOT: ./script/../config/.. > > Application Trace | Framework Trace | Full Trace > D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `new'' > D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `initialize'' > D:/ruby/lib/ruby/1.8/net/http.rb:430:in `open'' > D:/ruby/lib/ruby/1.8/net/http.rb:430:in `do_start'' > D:/ruby/lib/ruby/1.8/net/http.rb:419:in `start'' > D:/ruby/lib/ruby/1.8/net/http.rb:821:in `request'' > D:/ruby/lib/ruby/1.8/net/http.rb:615:in `get'' > ------------------------------------------------------------------------------------------------------------------ > > Any clue ?? > Is it something to do with SSL certification ? > > Thanks, > Karika Shah >-- ==============================================================================Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz ===============================================================================
Karika
2009-May-07 15:57 UTC
Re: open call works fine in irb but not through webrick server
I tried using script/console It still give me same error ... --------------------------------------------------------------------------------------------------------------------------------- D:\Ruby Applications\website>ruby script\console Loading development environment.>> require ''open-uri''=> true>> source = "http://google.com"=> "http://google.com">> open(source)OpenSSL::SSL::SSLError: SSL_CTX_new:: library has no ciphers from D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `new'' from D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `initialize'' from D:/ruby/lib/ruby/1.8/net/http.rb:430:in `open'' from D:/ruby/lib/ruby/1.8/net/http.rb:430:in `do_start'' from D:/ruby/lib/ruby/1.8/net/http.rb:419:in `start'' from D:/ruby/lib/ruby/1.8/net/http.rb:324:in `start'' from D:/ruby/lib/ruby/1.8/open-uri.rb:544:in `proxy_open'' from D:/ruby/lib/ruby/1.8/open-uri.rb:525:in `direct_open'' from D:/ruby/lib/ruby/1.8/open-uri.rb:169:in `open_loop'' from D:/ruby/lib/ruby/1.8/open-uri.rb:164:in `catch'' from D:/ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'' from D:/ruby/lib/ruby/1.8/open-uri.rb:134:in `open_uri'' from D:/ruby/lib/ruby/1.8/open-uri.rb:424:in `open'' from D:/ruby/lib/ruby/1.8/open-uri.rb:85:in `open'' from (irb):13>>--------------------------------------------------------------------------------------------------------------------------------- On May 6, 6:49 pm, Tom Z Meinlschmidt <to...-ooGa/4BNRfSw0JuIXryQZA@public.gmane.org> wrote:> irb != rails > > so try this script via script/console > > irb is interactive ruby console, so libraries etc could be different for > ruby and for rails > > if this will work in script/console, then it will work via > mongrel/webrick as well > > tm > > > > > > Karikawrote: > > require ''rss/1.0'' > > require ''rss/2.0'' > > require ''open-uri'' > > > source = "something.com" # url or local file > > content = "" # raw content of url will be loaded here > > open(source,:proxy => nil) do |s| content = s.read end > > rss = RSS::Parser.parse(content, false) > > > puts "Root values" > > print "RSS title: ", rss.channel.title, "\n" > > ############################################## > > Now, running this code through IRB works fine and gives me correct > > result. > > Whereas, If I run same piece of code through WEBRICK server, it gives > > me following error ... > > > ------------------------------------------------------------------------------------------------------------------ > > OpenSSL::SSL::SSLError in Document#feed > > SSL_CTX_new:: library has no ciphers > > RAILS_ROOT: ./script/../config/.. > > > Application Trace | Framework Trace | Full Trace > > D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `new'' > > D:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:38:in `initialize'' > > D:/ruby/lib/ruby/1.8/net/http.rb:430:in `open'' > > D:/ruby/lib/ruby/1.8/net/http.rb:430:in `do_start'' > > D:/ruby/lib/ruby/1.8/net/http.rb:419:in `start'' > > D:/ruby/lib/ruby/1.8/net/http.rb:821:in `request'' > > D:/ruby/lib/ruby/1.8/net/http.rb:615:in `get'' > > ------------------------------------------------------------------------------------------------------------------ > > > Any clue ?? > > Is it something to do with SSL certification ? > > > Thanks, > >KarikaShah > > -- > ==============================================================================> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache > > www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz > ===============================================================================- Hide quoted text - > > - Show quoted text -