mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/net-http] Initialize OpenSSL early before creating TCPSocket
OpenSSL make take some time to initialize, and it would be best to take that time before connecting instead of after. From joshc on Redmine. Fixes Ruby Bug #9459 https://github.com/ruby/net-http/commit/14e09fba24
This commit is contained in:
parent
1229ad0528
commit
0296a64450
1 changed files with 6 additions and 1 deletions
|
@ -972,6 +972,12 @@ module Net #:nodoc:
|
|||
private :do_start
|
||||
|
||||
def connect
|
||||
if use_ssl?
|
||||
# reference early to load OpenSSL before connecting,
|
||||
# as OpenSSL may take time to load.
|
||||
@ssl_context = OpenSSL::SSL::SSLContext.new
|
||||
end
|
||||
|
||||
if proxy? then
|
||||
conn_addr = proxy_address
|
||||
conn_port = proxy_port
|
||||
|
@ -1018,7 +1024,6 @@ module Net #:nodoc:
|
|||
end
|
||||
end
|
||||
end
|
||||
@ssl_context = OpenSSL::SSL::SSLContext.new
|
||||
@ssl_context.set_params(ssl_parameters)
|
||||
@ssl_context.session_cache_mode =
|
||||
OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT |
|
||||
|
|
Loading…
Reference in a new issue