@@ -1244,32 +1244,28 @@ def check_supported_protocol_versions
1244
1244
OpenSSL ::SSL ::TLS1_1_VERSION ,
1245
1245
OpenSSL ::SSL ::TLS1_2_VERSION ,
1246
1246
OpenSSL ::SSL ::TLS1_3_VERSION ,
1247
- ] . compact
1247
+ ]
1248
1248
1249
- # Prepare for testing & do sanity check
1250
1249
supported = [ ]
1251
- possible_versions . each do |ver |
1252
- catch ( :unsupported ) {
1253
- ctx_proc = proc { |ctx |
1254
- begin
1255
- ctx . min_version = ctx . max_version = ver
1256
- rescue ArgumentError , OpenSSL ::SSL ::SSLError
1257
- throw :unsupported
1258
- end
1250
+ ctx_proc = proc { |ctx |
1251
+ # Explicitly reset them to avoid influenced by OPENSSL_CONF
1252
+ ctx . min_version = ctx . max_version = nil
1253
+ }
1254
+ start_server ( ctx_proc : ctx_proc , ignore_listener_error : true ) do |port |
1255
+ possible_versions . each do |ver |
1256
+ ctx = OpenSSL ::SSL ::SSLContext . new
1257
+ ctx . min_version = ctx . max_version = ver
1258
+ server_connect ( port , ctx ) { |ssl |
1259
+ ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1259
1260
}
1260
- start_server ( ctx_proc : ctx_proc , ignore_listener_error : true ) do |port |
1261
- begin
1262
- server_connect ( port ) { |ssl |
1263
- ssl . puts "abc" ; assert_equal "abc\n " , ssl . gets
1264
- }
1265
- rescue OpenSSL ::SSL ::SSLError , Errno ::ECONNRESET
1266
- else
1267
- supported << ver
1268
- end
1269
- end
1270
- }
1261
+ supported << ver
1262
+ rescue OpenSSL ::SSL ::SSLError , Errno ::ECONNRESET
1263
+ end
1271
1264
end
1272
- assert_not_empty supported
1265
+
1266
+ # Sanity check: in our test suite we assume these are always supported
1267
+ assert_include ( supported , OpenSSL ::SSL ::TLS1_2_VERSION )
1268
+ assert_include ( supported , OpenSSL ::SSL ::TLS1_3_VERSION )
1273
1269
1274
1270
supported
1275
1271
end
0 commit comments