tags:

views:

70

answers:

0

I'm downloading files from a HTTPS website. I've narrowed the problem down to this:

>> require 'open-uri'
>> open('https://www.gmail.com/') # just as an example
C:/Ruby/lib/ruby/1.8/net/http.rb:586:in `connect': certificate verify failed (OpenSSL::SSL::SSLError)
    from C:/Ruby/lib/ruby/1.8/net/http.rb:586:in `connect'
    from C:/Ruby/lib/ruby/1.8/net/http.rb:553:in `do_start'
    from C:/Ruby/lib/ruby/1.8/net/http.rb:542:in `start'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:242:in `open_http'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:162:in `catch'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:518:in `open'
    from C:/Ruby/lib/ruby/1.8/open-uri.rb:30:in `open'
    from openuri_sandbox.rb:3

This code works just fine on Mac OS X or Linux, but it just started failing on Windows. I've tested on a few Win XP installations and one Win 7 installation -- they all fail. They're all running Ruby 1.8.6 patchlevel 287. What's going on here? We know we can turn off SSL verification and it works (or at least seems to), but that seems like a poor solution.

I'm interfacing with the website in question using Mechanize, so I'd like to be able to continue to use that.

Update: It looks like the problem with Mechanize might be specific to Windows 7, unlike I previously thought. It worked just a couple of weeks ago, though.

Update 2: This is still happening on Windows (XP and 7), but not on Linux. It's no longer a problem in the important script I needed to make work, though -- still not sure why.