Method: OpenSSL::SSL::SSLSocket#post_connection_check
- Defined in:
- lib/openssl/ssl.rb
#post_connection_check(hostname) ⇒ Object
Perform hostname verification after an SSL connection is established
This method MUST be called after calling #connect to ensure that the hostname of a remote peer has been verified.
230 231 232 233 234 235 |
# File 'lib/openssl/ssl.rb', line 230 def post_connection_check(hostname) unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname) raise SSLError, "hostname \"#{hostname}\" does not match the server certificate" end return true end |