File: peer_cert.rb

package info (click to toggle)
ruby-httparty 0.21.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 908 kB
  • sloc: ruby: 6,782; xml: 425; sh: 35; makefile: 14
file content (9 lines) | stat: -rw-r--r-- 291 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
require File.join(dir, 'httparty')

peer_cert = nil
HTTParty.get("https://www.example.com") do |fragment|
  peer_cert ||= fragment.connection.peer_cert
end

puts "The server's certificate expires #{peer_cert.not_after}"