File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ def ssl_verify_peer(cert_string)
5555 rescue OpenSSL ::X509 ::StoreError => e
5656 raise e unless e . message == 'cert already in hash table'
5757 end
58+ else
59+ raise OpenSSL ::SSL ::SSLError . new ( %(unable to verify the server certificate for "#{ sni_hostname } ") )
5860 end
5961
6062 true
@@ -68,8 +70,8 @@ def ssl_handshake_completed
6870 end
6971
7072 unless certificate_store . verify ( @last_seen_cert ) &&
71- OpenSSL ::SSL . verify_certificate_identity ( @last_seen_cert , host )
72- raise OpenSSL ::SSL ::SSLError . new ( %(host "#{ host } " does not match the server certificate) )
73+ OpenSSL ::SSL . verify_certificate_identity ( @last_seen_cert , sni_hostname )
74+ raise OpenSSL ::SSL ::SSLError . new ( %(host "#{ sni_hostname } " does not match the server certificate) )
7375 else
7476 true
7577 end
@@ -83,6 +85,10 @@ def host
8385 parent . connopts . host
8486 end
8587
88+ def sni_hostname
89+ parent . connopts . tls [ :sni_hostname ]
90+ end
91+
8692 def certificate_store
8793 @certificate_store ||= begin
8894 store = OpenSSL ::X509 ::Store . new
You can’t perform that action at this time.
0 commit comments