I'm running on Windows 7 normal OS.
Ruby, SSL, and Windows don't like each other, so simple commands like these don't work for me and it's giving me a real headache. I've tried getting RVM, updating my environmental variables, practically everything.
I don't know what the solution is. Is there a solution to install the OpenSSL gem for Ruby 1.9.3?
require 'mechanize'
agent = Mechanize.new
page = agent.get('https://any-ssl-site-here.com')
puts page
So whenever you try to use libraries to access
https
urls on Windows they basically fail because OpenSSL doesn't know where to look for theca_file
.The fix is pretty straight forward, get a CA Cert Bundle (my favorite is cURL's CA Bundle) and point whatever library you're going to use to it.
In the case of
mechanize
they do it using the#ca_file
instance method.In other words, change your code to:
Also, check out Luis Lavena's execellent answer to a similar question.