diff options
-rw-r--r-- | lib/net/http.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 9351606215..862f88dd37 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -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 | |