如何在發出SSL請求時訪問peer_cert?如何使用Ruby獲取https請求的peer_cert?
我已經更新了我的紅寶石SSL證書與rvm osx-ssl-certs update all
我想要是
require 'httpclient'
c = HTTPClient.new
r = c.get("https://gmail.com")
puts r.peer_cert
但我不斷收到任何 OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: sslv3 alert handshake failure
或
OpenSSL::SSL::SSLError: hostname "gmail.com" does not match the server certificate
第一個錯誤是什麼意思?有沒有辦法讓它自動設置屬性版本?
我能夠使用HTTParty和Farday加載URL上的數據,但在這種情況下,我不知道在這裏訪問實際使用的SSL證書。
你的代碼適合我。 – Max 2014-11-14 22:33:34
這可能是所有舊的httpclient <= 2.3.4.1的問題 – shiroginne 2014-12-04 14:10:59