我收到以下錯誤被發現:紅寶石Openssl的不NET :: HTTP
/Users/user_name/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/net/https.rb:124:in `use_ssl=': uninitialized constant Net::HTTP::OpenSSL (NameError)
所以,我打開了HTTPS文件,改變了一兩件事只是爲了看看會發生什麼,我這樣做:
def use_ssl=(flag)
:
@ssl_context = ::OpenSSL::SSL::SSLContext.new
如果你不能看到它,我的方法添加到::
OpenSSL::SSL::SSLContext.new
問題就消失了。
現在很明顯,我不能直接對Ruby庫編輯源代碼,所以我增加了以下我的腳本的頂部充當補丁:
module Net
class HTTP
def use_ssl=(flag)
flag = (flag ? true : false)
raise IOError, "use_ssl value changed, but session already started"\
if started? and @use_ssl != flag
if flag and not @ssl_context
@ssl_context = ::OpenSSL::SSL::SSLContext.new
end
@use_ssl = flag
end
end
end
但是我得到一個錯誤:
scripts/get_social_data.rb:27:in `use_ssl=': uninitialized constant OpenSSL (NameError)
儘管已經完成:
require 'openssl'
在我的腳本的頂部。
爲什麼OpenSSL
即使我要求它不存在?
我猜我失去了一些東西,但我真的不能看到它。
編輯:
好吧,我發現了OpenSSL(我保持這個項目)是在Gemfile中,我敢肯定它不應該在那裏,我卸載它,但它仍然沒有工作。