Bugs item #9416, was opened at 2007-03-20 23:38
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9416&group_id=426

Category: Standard Library
Group: 1.8.6
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Nicolas Untz (nuntz)
>Assigned to: Technorama Ltd. (technorama)
Summary: net/https peer_cert returning nil

Initial Comment:
The following will return nil on 1.8.6, but properly returns the cert data in 1.8.2.

require 'net/https'
port, path = 443, "/"
h = Net::HTTP.new('some.ssl.web.site', port)
h.use_ssl = true
h.get(path)
puts h.peer_cert


----------------------------------------------------------------------

Comment By: Technorama Ltd. (technorama)
Date: 2007-04-04 04:31

Message:
You can only retrieve the peer_cert while the connection is open.

Try this:

h = Net::HTTP.new('some.ssl.web.site', port)
h.use_ssl = true
h.start do
#  h.get(path)
  puts h.peer_cert
end

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9416&group_id=426