123456789_123456789_123456789_123456789_123456789_

Class: Bundler::PersistentHTTP

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Bundler::Persistent::Net::HTTP::Persistent
Defined in: lib/bundler/vendored_persistent.rb

Constant Summary

Persistent::Net::HTTP::Persistent - Inherited

DEFAULT_POOL_SIZE, EPOCH, HAVE_OPENSSL, VERSION

Class Method Summary

Persistent::Net::HTTP::Persistent - Inherited

.detect_idle_timeout

Use this method to detect the idle timeout of the host at uri.

.new

Instance Attribute Summary

Persistent::Net::HTTP::Persistent - Inherited

#ca_file

An SSL certificate authority.

#ca_file=

Sets the SSL certificate authority file.

#ca_path

A directory of SSL certificates to be used as certificate authorities.

#ca_path=

Sets the SSL certificate authority path.

#cert

For Net::HTTP parity.

#cert_store

An SSL certificate store.

#cert_store=

Overrides the default SSL certificate store used for verifying connections.

#certificate

This client’s OpenSSL::X509::Certificate

#certificate=

Sets this client’s OpenSSL::X509::Certificate

#ciphers

The ciphers allowed for SSL connections.

#ciphers=

The ciphers allowed for SSL connections.

#debug_output

Sends debug_output to this IO via Net::HTTP#set_debug_output.

#headers

Headers that are added to every request using Net::HTTP#add_field

#http_versions

Maps host:port to an HTTP version.

#idle_timeout

Maximum time an unused connection can remain idle before being automatically closed.

#keep_alive

The value sent in the Keep-Alive header.

#key

For Net::HTTP parity.

#max_requests

Maximum number of requests on a connection before it is considered expired and automatically closed.

#max_retries

Number of retries to perform if a request fails.

#max_retries=

Set the maximum number of retries for a request.

#max_version

Maximum SSL version to use, e.g. :TLS1_2.

#max_version=

maximum SSL version to use.

#min_version

Minimum SSL version to use, e.g. :TLS1_1.

#min_version=

Minimum SSL version to use.

#name

The name for this collection of persistent connections.

#no_proxy

List of host suffixes which will not be proxied.

#open_timeout

Seconds to wait until a connection is opened.

#override_headers

Headers that are added to every request using Net::HTTP#[]=

#private_key

This client’s SSL private key.

#private_key=

Sets this client’s SSL private key.

#proxy=

Sets the proxy server.

#proxy_uri

The URL through which requests will be proxied.

#read_timeout

Seconds to wait until reading one block.

#reuse_ssl_sessions

By default SSL sessions are reused to avoid extra SSL handshakes.

#socket_options

An array of options for Socket#setsockopt.

#ssl_timeout

SSL session lifetime.

#ssl_timeout=

SSL session lifetime.

#ssl_version

SSL version to use.

#ssl_version=

SSL version to use.

#verify_callback

SSL verification callback.

#verify_callback=

SSL verification callback.

#verify_depth

Sets the depth of SSL certificate verification.

#verify_depth=

Sets the depth of SSL certificate verification.

#verify_mode

HTTPS verify mode.

#verify_mode=

Sets the HTTPS verify mode.

#write_timeout

Seconds to wait until writing one block.

#generation

Current connection generation.

#pool

Test-only accessor for the connection pool.

#ssl_generation

Current SSL connection generation.

#timeout_key

Where this instance’s last-use times live in the thread local variables.

Instance Method Summary

Persistent::Net::HTTP::Persistent - Inherited

#connection_for

Creates a new connection for uri

#escape

CGI.escape wrapper.

#expired?

Returns true if the connection should be reset due to an idle timeout, or maximum request count, false otherwise.

#finish

Finishes the Net::HTTP connection

#http_version

Returns the HTTP protocol version for uri

#normalize_uri

Adds “http://” to the String uri if it is missing.

#proxy_bypass?

Returns true when proxy should by bypassed for host.

#proxy_from_env

Creates a URI for an HTTP proxy server from ENV variables.

#reconnect

Forces reconnection of all HTTP connections, including TLS/SSL connections.

#reconnect_ssl

Forces reconnection of only TLS/SSL connections.

#request

Makes a request on uri.

#reset

Finishes then restarts the Net::HTTP connection

#shutdown

Shuts down all connections.

#ssl

Enables SSL on connection

#start

Starts the Net::HTTP connection

#unescape

CGI.unescape wrapper.

#request_setup

Creates a GET request if req_or_uri is a URI and adds headers to the request.

Constructor Details

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

Instance Method Details

#connection_for(uri)

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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