Method: OpenSSL::SSL::SSLContext#ssl_version=
- Defined in:
- lib/openssl/ssl.rb
#ssl_version=(meth) ⇒ Object
call-seq:
ctx.ssl_version = :TLSv1
ctx.ssl_version = "SSLv23"
Sets the SSL/TLS protocol version for the context. This forces connections to use only the specified protocol version. This is deprecated and only provided for backwards compatibility. Use #min_version= and #max_version= instead.
History
As the name hints, this used to call the SSL_CTX_set_ssl_version() function which sets the SSL method used for connections created from the context. As of Ruby/OpenSSL 2.1, this accessor method is implemented to call #min_version= and #max_version= instead.
208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/openssl/ssl.rb', line 208 def ssl_version=(meth) meth = meth.to_s if meth.is_a?(Symbol) if /(?<type>_client|_server)\z/ =~ meth meth = $` if $VERBOSE warn "#{caller(1, 1)[0]}: method type #{type.inspect} is ignored" end end version = METHODS_MAP[meth.intern] or raise ArgumentError, "unknown SSL method `%s'" % meth set_minmax_proto_version(version, version) @min_proto_version = @max_proto_version = version end |