Class: Bundler::PersistentHTTP

Inherits:
Bundler::Persistent::Net::HTTP::Persistent show all
Defined in:
lib/bundler/vendored_persistent.rb

Constant Summary

Constants inherited from Bundler::Persistent::Net::HTTP::Persistent

Bundler::Persistent::Net::HTTP::Persistent::DEFAULT_POOL_SIZE, Bundler::Persistent::Net::HTTP::Persistent::EPOCH, Bundler::Persistent::Net::HTTP::Persistent::HAVE_OPENSSL, Bundler::Persistent::Net::HTTP::Persistent::VERSION

Instance Attribute Summary

Attributes inherited from Bundler::Persistent::Net::HTTP::Persistent

#ca_file, #ca_path, #cert_store, #certificate, #ciphers, #debug_output, #generation, #headers, #http_versions, #idle_timeout, #keep_alive, #max_requests, #max_retries, #max_version, #min_version, #name, #no_proxy, #open_timeout, #override_headers, #pool, #private_key, #proxy_uri, #read_timeout, #reuse_ssl_sessions, #socket_options, #ssl_generation, #ssl_timeout, #ssl_version, #timeout_key, #verify_callback, #verify_depth, #verify_mode, #write_timeout

Instance Method Summary collapse

Methods inherited from Bundler::Persistent::Net::HTTP::Persistent

detect_idle_timeout, #escape, #expired?, #finish, #http_version, #initialize, #normalize_uri, #proxy=, #proxy_bypass?, #proxy_from_env, #reconnect, #reconnect_ssl, #request, #request_setup, #reset, #shutdown, #ssl, #start, #unescape

Constructor Details

This class inherits a constructor from Bundler::Persistent::Net::HTTP::Persistent

Instance Method Details

#connection_for(uri) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/bundler/vendored_persistent.rb', line 15

def connection_for(uri)
  super(uri) do |connection|
    result = yield connection
    warn_old_tls_version_rubygems_connection(uri, connection)
    result
  end
end

#warn_old_tls_version_rubygems_connection(uri, connection) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/bundler/vendored_persistent.rb', line 23

def warn_old_tls_version_rubygems_connection(uri, connection)
  return unless connection.http.use_ssl?
  return unless (uri.host || "").end_with?("rubygems.org")

  socket = connection.instance_variable_get(:@socket)
  return unless socket
  socket_io = socket.io
  return unless socket_io.respond_to?(:ssl_version)
  ssl_version = socket_io.ssl_version

  case ssl_version
  when /TLSv([\d\.]+)/
    version = Gem::Version.new($1)
    if version < Gem::Version.new("1.2")
      Bundler.ui.warn \
        "Warning: Your Ruby version is compiled against a copy of OpenSSL that is very old. " \
        "Starting in January 2018, RubyGems.org will refuse connection requests from these " \
        "very old versions of OpenSSL. If you will need to continue installing gems after " \
        "January 2018, please follow this guide to upgrade: http://ruby.to/tls-outdated.",
        :wrap => true
    end
  end
end