Skip to content

Commit 1b18710

Browse files
committed
now that we've matched w MRI's SSLContext::METHODS don't report custom ones
1 parent b06a965 commit 1b18710

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/main/java/org/jruby/ext/openssl/SSLContext.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ public static void createSSLContext(final Ruby runtime, final RubyModule SSL) {
171171

172172
final Set<String> methodKeys = SSL_VERSION_OSSL2JSSE.keySet();
173173
final RubyArray methods = runtime.newArray( methodKeys.size() );
174-
for ( String method : methodKeys ) {
175-
methods.append( runtime.newSymbol(method) );
174+
for ( final String method : methodKeys ) {
175+
if ( method.indexOf('.') == -1 ) {
176+
// do not "officially" report TLSv1.1 and TLSv1.2
177+
methods.append( runtime.newSymbol(method) );
178+
}
176179
}
177180
SSLContext.defineConstant("METHODS", methods);
178181
// in 1.8.7 as well as 1.9.3 :
@@ -416,7 +419,7 @@ public IRubyObject setup(final ThreadContext context) {
416419
}
417420

418421
@JRubyMethod
419-
public IRubyObject ciphers(final ThreadContext context) {
422+
public RubyArray ciphers(final ThreadContext context) {
420423
return matchedCiphers(context);
421424
}
422425

src/test/ruby/ssl/test_context.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
class TestSSLContext < TestCase
55
#include SSLTestHelper
66

7+
def test_methods
8+
methods = OpenSSL::SSL::SSLContext::METHODS
9+
assert methods.include?(:'SSLv3')
10+
assert methods.include?(:'TLSv1_1')
11+
assert ! methods.include?(:'TLSv1.1')
12+
end
13+
714
def test_context_set_ssl_version
815
context = OpenSSL::SSL::SSLContext.new
916
context.ssl_version = "TLSv1"

0 commit comments

Comments
 (0)