title: How to bypass SSL certificate verification in open-uri?
body: <p>I try to access a file with open-uri over an https connection. Unfortunately somethings wrong with the certificate, I get a <em>certificate verify failed</em> error. I can't do anything about that, so I have to bypass the verification.</p>
  
  <p>I found this <a href="http://www.peterkrantz.com/2007/open-uri-cert-verification/" rel="noreferrer">answer</a></p>
  
  <p>I don't want to / can't change the oen-uri.rb on the server, and I'm running Ruby 1.8.6.</p>
  
  <p>How do I change the verify mode? Or more exactly where do I change it?</p>
  
  <p>Where can I put this?</p>
  
  <pre><code>if target.class == URI::HTTPS  
   require 'net/https'  
   http.use_ssl = true   
   http.verify_mode = OpenSSL::SSL::VERIFY_NONE  
   store = OpenSSL::X509::Store.new  
   store.set_default_paths  
   http.cert_store = store
  end
  </code></pre>
  
  <p>or the dirty hack: where can I put this?</p>
  
  <pre><code>OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
  </code></pre>