@@ -98,7 +98,7 @@ public class SSLContext extends RubyObject {
9898 private static final Map <String , String []> ENABLED_PROTOCOLS ;
9999
100100 static {
101- SSL_VERSION_OSSL2JSSE = new LinkedHashMap <String , String >(16 );
101+ SSL_VERSION_OSSL2JSSE = new LinkedHashMap <String , String >(20 , 1 );
102102 ENABLED_PROTOCOLS = new HashMap <String , String []>(8 , 1 );
103103
104104 SSL_VERSION_OSSL2JSSE .put ("TLSv1" , "TLSv1" );
@@ -121,13 +121,20 @@ public class SSLContext extends RubyObject {
121121 SSL_VERSION_OSSL2JSSE .put ("SSLv23_client" , "SSL" );
122122 ENABLED_PROTOCOLS .put ("SSL" , new String [] { "SSLv2" , "SSLv3" , "TLSv1" });
123123
124- // Followings(TLS, TLSv1.1) are JSSE only methods at present. Let's allow user to use it.
124+ // Historically we were ahead of MRI to support TLS
125+ // ... thus the non-standard names version names :
125126
126127 SSL_VERSION_OSSL2JSSE .put ("TLS" , "TLS" );
127128 ENABLED_PROTOCOLS .put ("TLS" , new String [] { "TLSv1" , "TLSv1.1" });
128129
129130 SSL_VERSION_OSSL2JSSE .put ("TLSv1.1" , "TLSv1.1" );
130131 ENABLED_PROTOCOLS .put ("TLSv1.1" , new String [] { "TLSv1.1" });
132+
133+ SSL_VERSION_OSSL2JSSE .put ("TLSv1_1" , "TLSv1.1" ); // supported on MRI 2.x
134+ SSL_VERSION_OSSL2JSSE .put ("TLSv1_2" , "TLSv1.2" ); // supported on MRI 2.x
135+ ENABLED_PROTOCOLS .put ("TLSv1.2" , new String [] { "TLSv1.2" });
136+
137+ SSL_VERSION_OSSL2JSSE .put ("TLSv1.2" , "TLSv1.2" ); // just for completeness
131138 }
132139
133140 private static ObjectAllocator SSLCONTEXT_ALLOCATOR = new ObjectAllocator () {
@@ -269,7 +276,7 @@ public IRubyObject setup(final ThreadContext context) {
269276 internalContext = new InternalContext ();
270277
271278 // TODO: handle tmp_dh_callback :
272-
279+
273280 // #if !defined(OPENSSL_NO_DH)
274281 // if (RTEST(ossl_sslctx_get_tmp_dh_cb(self))){
275282 // SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
0 commit comments