mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
openssl: revert changes in SSLContext#{min,max}_version= in r60310
And adapt a net/http test to their old behavior. [ruby-core:83491] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c56ac08636
commit
55953e374d
2 changed files with 4 additions and 16 deletions
|
@ -148,7 +148,7 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
|
|||
|
||||
# call-seq:
|
||||
# ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
|
||||
# ctx.min_version = :TLSv1_2
|
||||
# ctx.min_version = :TLS1_2
|
||||
# ctx.min_version = nil
|
||||
#
|
||||
# Sets the lower bound on the supported SSL/TLS protocol version. The
|
||||
|
@ -167,30 +167,18 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
|
|||
# sock = OpenSSL::SSL::SSLSocket.new(tcp_sock, ctx)
|
||||
# sock.connect # Initiates a connection using either TLS 1.1 or TLS 1.2
|
||||
def min_version=(version)
|
||||
case version
|
||||
when nil, Integer
|
||||
else
|
||||
version = (METHODS_MAP[version] or
|
||||
raise ArgumentError, "unknown SSL version `#{version.inspect}'")
|
||||
end
|
||||
set_minmax_proto_version(version, @max_proto_version ||= nil)
|
||||
@min_proto_version = version
|
||||
end
|
||||
|
||||
# call-seq:
|
||||
# ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION
|
||||
# ctx.max_version = :TLSv1_2
|
||||
# ctx.max_version = :TLS1_2
|
||||
# ctx.max_version = nil
|
||||
#
|
||||
# Sets the upper bound of the supported SSL/TLS protocol version. See
|
||||
# #min_version= for the possible values.
|
||||
def max_version=(version)
|
||||
case version
|
||||
when nil, Integer
|
||||
else
|
||||
version = (METHODS_MAP[version] or
|
||||
raise ArgumentError, "unknown SSL version `#{version.inspect}'")
|
||||
end
|
||||
set_minmax_proto_version(@min_proto_version ||= nil, version)
|
||||
@max_proto_version = version
|
||||
end
|
||||
|
|
|
@ -195,7 +195,7 @@ class TestNetHTTPS < Test::Unit::TestCase
|
|||
def test_min_version
|
||||
http = Net::HTTP.new("127.0.0.1", config("port"))
|
||||
http.use_ssl = true
|
||||
http.min_version = :TLSv1
|
||||
http.min_version = :TLS1
|
||||
http.verify_callback = Proc.new do |preverify_ok, store_ctx|
|
||||
true
|
||||
end
|
||||
|
@ -208,7 +208,7 @@ class TestNetHTTPS < Test::Unit::TestCase
|
|||
def test_max_version
|
||||
http = Net::HTTP.new("127.0.0.1", config("port"))
|
||||
http.use_ssl = true
|
||||
http.max_version = :SSLv2
|
||||
http.max_version = :SSL2
|
||||
http.verify_callback = Proc.new do |preverify_ok, store_ctx|
|
||||
true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue