tags:

views:

292

answers:

2

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"
}
A: 

I haven't worked with ( or indeed heard of ) shoes, but when I have had problems with accessing stuff over HTTPS in Ruby it has often been a case of not having the certificate set up properly.

My experience with this was a couple of years ago now but it may be worth doing a bit of experimentation just to check that you can actually make a regular SSL connection with that code. I would expect that you would at least need to tell it where to find the client certificate or that it doesn't need a client certificate at all.

I also recall that I needed to use http-access2 rather than the regular http library.

As I say, I'm sure things have moved on since I was trying to do this, but most of the problems I found relating to ssl connections were certificate related.

glenatron
For the certificate I get a warning saying the certificate sent by the server is bad but thats it. Note that the above code works fine (except for a bad certificate warning) when run from command line or using rspec.But if I run from inside shoes only then I get this problem.
Ram
Ah, in that case I'm afraid I certainly can't help. It's probably worth looking at the shoe-specific mailing lists...
glenatron
A: 

Shoes doesn't support HTTPS in the current version.

Ram