@@ -98,7 +98,7 @@ public class SSLContext extends RubyObject {
98
98
private static final Map <String , String []> ENABLED_PROTOCOLS ;
99
99
100
100
static {
101
- SSL_VERSION_OSSL2JSSE = new LinkedHashMap <String , String >(16 );
101
+ SSL_VERSION_OSSL2JSSE = new LinkedHashMap <String , String >(20 , 1 );
102
102
ENABLED_PROTOCOLS = new HashMap <String , String []>(8 , 1 );
103
103
104
104
SSL_VERSION_OSSL2JSSE .put ("TLSv1" , "TLSv1" );
@@ -121,13 +121,20 @@ public class SSLContext extends RubyObject {
121
121
SSL_VERSION_OSSL2JSSE .put ("SSLv23_client" , "SSL" );
122
122
ENABLED_PROTOCOLS .put ("SSL" , new String [] { "SSLv2" , "SSLv3" , "TLSv1" });
123
123
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 :
125
126
126
127
SSL_VERSION_OSSL2JSSE .put ("TLS" , "TLS" );
127
128
ENABLED_PROTOCOLS .put ("TLS" , new String [] { "TLSv1" , "TLSv1.1" });
128
129
129
130
SSL_VERSION_OSSL2JSSE .put ("TLSv1.1" , "TLSv1.1" );
130
131
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
131
138
}
132
139
133
140
private static ObjectAllocator SSLCONTEXT_ALLOCATOR = new ObjectAllocator () {
@@ -269,7 +276,7 @@ public IRubyObject setup(final ThreadContext context) {
269
276
internalContext = new InternalContext ();
270
277
271
278
// TODO: handle tmp_dh_callback :
272
-
279
+
273
280
// #if !defined(OPENSSL_NO_DH)
274
281
// if (RTEST(ossl_sslctx_get_tmp_dh_cb(self))){
275
282
// SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
0 commit comments