@@ -132,16 +132,15 @@ class SSLContext
132
132
# used.
133
133
def set_params ( params = { } )
134
134
params = DEFAULT_PARAMS . merge ( params )
135
- # TODO JRuby: need to support SSLContext#options (since Ruby 2.5)
136
- #self.options = params.delete(:options) # set before min_version/max_version
137
- params . each { |name , value | self . __send__ ( "#{ name } =" , value ) }
135
+ self . options = params . delete ( :options ) # set before min_version/max_version
136
+ params . each { |name , value | self . __send__ ( "#{ name } =" , value ) }
138
137
if self . verify_mode != OpenSSL ::SSL ::VERIFY_NONE
139
138
unless self . ca_file or self . ca_path or self . cert_store
140
139
self . cert_store = DEFAULT_CERT_STORE
141
140
end
142
141
end
143
142
return params
144
- end unless method_defined? :set_params
143
+ end
145
144
146
145
# call-seq:
147
146
# ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
@@ -194,29 +193,29 @@ def max_version=(version)
194
193
# function which sets the SSL method used for connections created from
195
194
# the context. As of Ruby/OpenSSL 2.1, this accessor method is
196
195
# implemented to call #min_version= and #max_version= instead.
197
- def ssl_version = ( meth )
198
- meth = meth . to_s if meth . is_a? ( Symbol )
199
- if /(?<type>_client|_server)\z / =~ meth
200
- meth = $`
201
- if $VERBOSE
202
- warn "#{ caller ( 1 , 1 ) [ 0 ] } : method type #{ type . inspect } is ignored"
203
- end
204
- end
205
- version = METHODS_MAP [ meth . intern ] or
206
- raise ArgumentError , "unknown SSL method `%s'" % meth
207
- set_minmax_proto_version ( version , version )
208
- @min_proto_version = @max_proto_version = version
209
- end unless method_defined? :ssl_version=
210
-
211
- METHODS_MAP = {
212
- SSLv23 : 0 ,
213
- SSLv2 : OpenSSL ::SSL ::SSL2_VERSION ,
214
- SSLv3 : OpenSSL ::SSL ::SSL3_VERSION ,
215
- TLSv1 : OpenSSL ::SSL ::TLS1_VERSION ,
216
- TLSv1_1 : OpenSSL ::SSL ::TLS1_1_VERSION ,
217
- TLSv1_2 : OpenSSL ::SSL ::TLS1_2_VERSION ,
218
- } . freeze
219
- private_constant :METHODS_MAP
196
+ # def ssl_version=(meth)
197
+ # meth = meth.to_s if meth.is_a?(Symbol)
198
+ # if /(?<type>_client|_server)\z/ =~ meth
199
+ # meth = $`
200
+ # if $VERBOSE
201
+ # warn "#{caller(1, 1)[0]}: method type #{type.inspect} is ignored"
202
+ # end
203
+ # end
204
+ # version = METHODS_MAP[meth.intern] or
205
+ # raise ArgumentError, "unknown SSL method `%s'" % meth
206
+ # set_minmax_proto_version(version, version)
207
+ # @min_proto_version = @max_proto_version = version
208
+ # end
209
+ #
210
+ # METHODS_MAP = {
211
+ # SSLv23: 0,
212
+ # SSLv2: OpenSSL::SSL::SSL2_VERSION,
213
+ # SSLv3: OpenSSL::SSL::SSL3_VERSION,
214
+ # TLSv1: OpenSSL::SSL::TLS1_VERSION,
215
+ # TLSv1_1: OpenSSL::SSL::TLS1_1_VERSION,
216
+ # TLSv1_2: OpenSSL::SSL::TLS1_2_VERSION,
217
+ # }.freeze
218
+ # private_constant :METHODS_MAP
220
219
221
220
# METHODS setup from native (JRuby)
222
221
# The list of available SSL/TLS methods. This constant is only provided
0 commit comments