From 40aa32a0d7ce7a651a610cc69cced23319a11cd5 Mon Sep 17 00:00:00 2001 From: gotoyuzo Date: Sat, 22 Dec 2007 08:31:53 +0000 Subject: * ext/openssl/lib/net/ssl.rb (OpenSSL::SSL::SSLContext.build): removed. * ext/openssl/lib/net/ssl.rb (OpenSSL::SSL::SSLContext#set_params): new method to set suitable SSL parameters. * lib/net/pop.rb, lib/net/http.rb, lib/net/imap.rb, test/openssl/test_ssl.rb: follow above change. * test/net/http/test_https.rb: refine error case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/http.rb | 3 ++- lib/net/imap.rb | 5 +++-- lib/net/pop.rb | 7 ++++--- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/net/http.rb b/lib/net/http.rb index 9e2aeee2c4..b9fadd2fe5 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -581,7 +581,8 @@ module Net #:nodoc: ssl_parameters[name] = value end end - @ssl_context = OpenSSL::SSL::SSLContext.build(ssl_parameters) + @ssl_context = OpenSSL::SSL::SSLContext.new + @ssl_context.set_params(ssl_parameters) s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context) s.sync_close = true end diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 2398a5d10c..394f0d9890 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -892,7 +892,7 @@ module Net # OpenSSL [OSSL] and the Ruby OpenSSL [RSSL] extensions need to # be installed. # if options[:ssl] is a hash, it's passed to - # OpenSSL::SSL::SSLContext.build as parameters. + # OpenSSL::SSL::SSLContext#set_params as parameters. # # The most common errors are: # @@ -1263,7 +1263,8 @@ module Net rescue NoMethodError params = {} end - context = SSLContext.build(params) + context = SSLContext.new + context.set_params(params) if defined?(VerifyCallbackProc) context.verify_callback = VerifyCallbackProc end diff --git a/lib/net/pop.rb b/lib/net/pop.rb index 6b21da189c..cbe5630271 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -328,7 +328,7 @@ module Net # Net::POP.enable_ssl(params = {}) # # Enable SSL for all new instances. - # +params+ is passed to OpenSSL::SSLContext.build. + # +params+ is passed to OpenSSL::SSLContext#set_params. def POP3.enable_ssl(*args) @ssl_params = create_ssl_params(*args) end @@ -441,7 +441,7 @@ module Net # Enables SSL for this instance. Must be called before the connection is # established to have any effect. # +params[:port]+ is port to establish the SSL connection on; Defaults to 995. - # +params+ (except :port) is passed to OpenSSL::SSLContext.build. + # +params+ (except :port) is passed to OpenSSL::SSLContext#set_params. def enable_ssl(verify_or_params = {}, certs = nil, port = nil) begin @ssl_params = verify_or_params.to_hash.dup @@ -534,7 +534,8 @@ module Net s = timeout(@open_timeout) { TCPSocket.open(@address, port) } if use_ssl? raise 'openssl library not installed' unless defined?(OpenSSL) - context = OpenSSL::SSL::SSLContext.build(@ssl_params) + context = OpenSSL::SSL::SSLContext.new + context.set_params(@ssl_params) s = OpenSSL::SSL::SSLSocket.new(s, context) s.sync_close = true s.connect -- cgit v1.2.3