From e1d1a83e61bb6b2fbc646ac42addbafc1defb132 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Wed, 4 Mar 2015 13:18:14 +0000 Subject: Work correctly if SSL library is too old for SNI. --- lib/custodian/protocoltest/ssl.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/custodian') diff --git a/lib/custodian/protocoltest/ssl.rb b/lib/custodian/protocoltest/ssl.rb index a979fcb..4d4ee2f 100644 --- a/lib/custodian/protocoltest/ssl.rb +++ b/lib/custodian/protocoltest/ssl.rb @@ -158,7 +158,14 @@ class SSLCheck s = TCPSocket.open(uri.host, uri.port) s = OpenSSL::SSL::SSLSocket.new(s, ctx) s.sync_close = true - s.hostname = uri.host # SNI + + # Setup a hostname for SNI-purposes. + begin + s.hostname = uri.host + rescue NoMethodError => err + # SNI isn't possible, as the SSL library is too old. + end + s.connect @certificate = s.peer_cert self.bundle = s.peer_cert_chain -- cgit v1.2.1