Open call works fine in irb but not through webrick server


#1

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:ininitialize’
D:/ruby/lib/ruby/1.8/net/http.rb:430:in open' D:/ruby/lib/ruby/1.8/net/http.rb:430:indo_start’
D:/ruby/lib/ruby/1.8/net/http.rb:419:in start' D:/ruby/lib/ruby/1.8/net/http.rb:821:inrequest’
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


#2

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:

print "RSS title: ", rss.channel.title, “\n”

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


#3

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:ininitialize’
from D:/ruby/lib/ruby/1.8/net/http.rb:430:in open' from D:/ruby/lib/ruby/1.8/net/http.rb:430:indo_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:instart’
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:indirect_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:incatch’
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:inopen_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:inopen’
from (irb):13