另一个关于Windows问题的openssl,VERIFY_NONE没有帮助

我正在尝试制作一个小的ruby脚本来上传我自己的视频。这里是完整的代码,它很短:
    require 'openssl'
    OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE # warning: already initialized constant VERIFY_PEER n 0 
    require 'youtube_it'
    require 'rest-client'

    # Authentication
    auth_devkey      = '...'
    auth_user        = '...'
    auth_pass        = '...'

    # Getting auth token
    response    = RestClient.post "https://www.google.com/accounts/ClientLogin", {:Email => auth_user, :Passwd => auth_pass, :service => "youtube", :source => "..."}, :content_type => 'application/x-www-form-urlencoded'
    auth_token  = response[/(?<=auth=).*/i]
    # so far so good

    # creating a new youtube_it client
    yt_client   = YouTubeIt::Client.new(:username => auth_user, :password =>  auth_pass, :dev_key => auth_devkey)
    # A-Okay


    # Uploading video
    vpath       = "c:/downloads/videos/video.mov"
    upload_response = yt_client.video_upload(File.open(vpath), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test], :list => 'denied')

    # big error here
    OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
            from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:677:in `connect'
            from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:677:in `connect'
            from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:637:in `do_start'
            from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:626:in `start'
            from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1160:in `request'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.1/lib/restclient/net_http_ext.rb:17:in `request'
            from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:970:in `post'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/youtube_it-1.4.1/lib/youtube_it/request/video_upload.rb:525:in `auth_token'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/youtube_it-1.4.1/lib/youtube_it/request/video_upload.rb:463:in `authorization_hea
    ders'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/youtube_it-1.4.1/lib/youtube_it/request/video_upload.rb:94:in `upload'
            from C:/Ruby192/lib/ruby/gems/1.9.1/gems/youtube_it-1.4.1/lib/youtube_it/client.rb:99:in `video_upload'
            from (irb):81
            from C:/Ruby192/bin/irb:12:in `<main>'
我相信如果我能立即提供任何其他信息,我可能会错过这里的粘贴,这是解决这个问题的必要条件。我不想在没有谷歌搜索至少4个小时的情况下轻轻地提问,但我找不到任何有用的东西。 谢谢十亿!     
已邀请:
大家好,这个错误在youtube_it的最后一个版本中修复了,你可以在这里看到 https://github.com/kylejginavan/youtube_it/commit/032f2800ae4c4ab9f6000b23150e3a8d3517815f 问候!     
问题是你不能这样做:
   OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE 
您必须修改SSLContext实例的:verify_mode属性。 您可以尝试通过rest-client中的instance_variable_get获取NET :: HTTP对象的实例变量,然后相应地设置:verify_mode。 更好的方法是直接设置rest-client本身的:verify_ssl属性:
RestClient::Request.execute(:method => :post, :url => 'http://example.com', :verify_ssl => OpenSSL::SSL::VERIFY_NONE )
为了进一步阅读,我建议在这里查看源代码     

要回复问题请先登录注册