Ok when I do that, it says:
ssl value changed, but session already started
dusty wrote:
Hello,
I am usring open-uri to open an https:// link and when it tries to read
it, I get the 'connect' : certificate verify failed error. How can I
bypass this SSL verification?
Thanks,
M
--
Posted viahttp://
www.ruby-forum.com/.
Set the verify_mode to OpenSSL::SSL::VERIFY_NONE
eg:
http = Net::HTTP.new(host,port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
--
Posted viahttp://
www.ruby-forum.com/.
Sorry, I guess you can't do it with open-uri. Here is a patch:
add this ssl_verify option to the top of the file.
FROM:
module OpenURI
Options = {
roxy => true,
rogress_proc => true,
:content_length_proc => true,
:http_basic_authentication => true,
}
TO:
module OpenURI
Options = {
roxy => true,
rogress_proc => true,
:content_length_proc => true,
:http_basic_authentication => true,
:ssl_verify => true
}
Change the part where it enables verification
FROM:
if target.class == URI::HTTPS
require 'net/https'
http.use_ssl = true
http.enable_post_connection_check = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
store = OpenSSL::X509::Store.new
store.set_default_paths
http.cert_store = store
end
TO:
if target.class == URI::HTTPS
require 'net/https'
http.use_ssl = true
http.enable_post_connection_check = true
if options[:ssl_verify] == false
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
else
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
store = OpenSSL::X509::Store.new
store.set_default_paths
http.cert_store = store
end
run it like this:
open("
https://someurl", :ssl_verify => false) {|f|
print f.read
}