File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ def initialize(version = nil)
136136 # used.
137137 def set_params ( params = { } )
138138 params = DEFAULT_PARAMS . merge ( params )
139+ self . options = params . delete ( :options ) # set before min_version/max_version
139140 params . each { |name , value | self . __send__ ( "#{ name } =" , value ) }
140141 if self . verify_mode != OpenSSL ::SSL ::VERIFY_NONE
141142 unless self . ca_file or self . ca_path or self . cert_store
@@ -201,7 +202,7 @@ def ssl_version=(meth)
201202 if /(?<type>_client|_server)\z / =~ meth
202203 meth = $`
203204 if $VERBOSE
204- warn "#{ caller ( 1 ) [ 0 ] } : method type #{ type . inspect } is ignored"
205+ warn "#{ caller ( 1 , 1 ) [ 0 ] } : method type #{ type . inspect } is ignored"
205206 end
206207 end
207208 version = METHODS_MAP [ meth . intern ] or
Original file line number Diff line number Diff line change @@ -811,6 +811,24 @@ def check_supported_protocol_versions
811811 supported
812812 end
813813
814+ def test_set_params_min_version
815+ supported = check_supported_protocol_versions
816+ store = OpenSSL ::X509 ::Store . new
817+ store . add_cert ( @ca_cert )
818+
819+ if supported . include? ( OpenSSL ::SSL ::SSL3_VERSION )
820+ # SSLContext#set_params properly disables SSL 3.0 by default
821+ ctx_proc = proc { |ctx |
822+ ctx . min_version = ctx . max_version = OpenSSL ::SSL ::SSL3_VERSION
823+ }
824+ start_server ( ctx_proc : ctx_proc , ignore_listener_error : true ) { |port |
825+ ctx = OpenSSL ::SSL ::SSLContext . new
826+ ctx . set_params ( cert_store : store , verify_hostname : false )
827+ assert_handshake_error { server_connect ( port , ctx ) { } }
828+ }
829+ end
830+ end
831+
814832 def test_minmax_version
815833 supported = check_supported_protocol_versions
816834
You can’t perform that action at this time.
0 commit comments