Search code examples
rubyhttpsshoes

Using Shoes and download over https gives ssl errors


In a shoes application am trying to download stuff from some internal websites. I get this error

Error in /tmp/selfgz14214/ruby/lib/net/protocol.rb line 66
undefined method 'closed?' for #<OpenSSL::SSL::SSLSocket:0xb6af94f0>

I got the above error for this code. This give the above error if used from Shoes.

require 'net/http'
require 'net/https'
require 'rexml/document'

class Blogs
  attr_reader :Connection

  def initialize
    @Connection = Net::HTTP::new("someInternalWebSite", 443)
    @Connection.use_ssl = true
  end

  def get_blogs
    doc = REXML::Document.new @Connection.get('/weblogs/feed/entries/atom').body
    blogs = Array.new
    # ----- some crap to parse the blogs
    return blogs
  end

end

Note this problem only happens when run from inside shoes.

Also using the inbuilt download method in shoes it doesn't return, not even start event gets raised. The following is the code for that

download "https://internalWebsite/weblogs/feed/entries/atom",
:start => lambda {
  alert "hello"
},
:progress => lambda {
  alert "progress"
},
:finish => lambda {
  alert "finish"
}

Solution

  • Shoes doesn't support HTTPS in the current version.