File tree 1 file changed +8
-2
lines changed
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)
55
55
rescue OpenSSL ::X509 ::StoreError => e
56
56
raise e unless e . message == 'cert already in hash table'
57
57
end
58
+ else
59
+ raise OpenSSL ::SSL ::SSLError . new ( %(unable to verify the server certificate for "#{ sni_hostname } ") )
58
60
end
59
61
60
62
true
@@ -68,8 +70,8 @@ def ssl_handshake_completed
68
70
end
69
71
70
72
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) )
73
75
else
74
76
true
75
77
end
@@ -83,6 +85,10 @@ def host
83
85
parent . connopts . host
84
86
end
85
87
88
+ def sni_hostname
89
+ parent . connopts . tls [ :sni_hostname ]
90
+ end
91
+
86
92
def certificate_store
87
93
@certificate_store ||= begin
88
94
store = OpenSSL ::X509 ::Store . new
You can’t perform that action at this time.
0 commit comments