def initialize name = nil, proxy = nil
@name = name
@proxy_uri = case proxy
when :ENV then proxy_from_env
when URI::HTTP then proxy
when nil then
else raise ArgumentError, 'proxy must be :ENV or a URI::HTTP'
end
if @proxy_uri then
@proxy_args = [
@proxy_uri.host,
@proxy_uri.port,
@proxy_uri.user,
@proxy_uri.password,
]
@proxy_connection_id = [nil, *@proxy_args].join ':'
end
@debug_output = nil
@headers = {}
@http_versions = {}
@keep_alive = 30
@open_timeout = nil
@read_timeout = nil
@idle_timeout = 5
@socket_options = []
@socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
Socket.const_defined? :TCP_NODELAY
key = ['net_http_persistent', name].compact
@connection_key = [key, 'connections'].join('_').intern
@request_key = [key, 'requests'].join('_').intern
@timeout_key = [key, 'timeouts'].join('_').intern
@certificate = nil
@ca_file = nil
@private_key = nil
@verify_callback = nil
@verify_mode = OpenSSL::SSL::VERIFY_PEER
@cert_store = nil
@reuse_ssl_sessions = true
@retry_change_requests = false
end