class Net::HTTP::ConnectionPool::Session
@private
Users should never need to interact with these session wrappers.
Used by Net::HTTP::ConnectionPool to wrap Net::HTTP::Session objects.
def finish
-
(nil)
-
def finish begin http_session.finish if http_session.started? rescue IOError end nil end
def initialize http_session, key
-
key
(String
) -- -
http_session
(Net::HTTPSession
) --
def initialize http_session, key @http_session = http_session @key = key @created_at = Time.now @last_used_at = nil end
def read_timeout= timeout
-
timeout
(Integer
) -- Number of seconds before Net::HTTP should
def read_timeout= timeout http_session.read_timeout = timeout end
def request *args, &block
-
(nil)
-
Other tags:
- Yieldparam: response -
Other tags:
- Yield: -
def request *args, &block http_session.request(*args, &block) @last_used_at = Time.now nil end
def start connection, options = {}
-
(Session)
-
Options Hash:
(**options)
-
:debug_logger
(Logger
) -- HTTP wire traces are logged -
:open_timeout
(Integer
) -- The number of seconds to
Parameters:
-
options
(Hash
) -- -
connection
(Connection
) --
def start connection, options = {} http_args = [] http_args << connection.host http_args << connection.port if connection.proxy? http_args << connection.proxy_address http_args << connection.proxy_port http_args << connection.proxy_user http_args << connection.proxy_password end http = Net::HTTP.new(*http_args) http.set_debug_output(options[:debug_logger]) if options[:debug_logger] http.open_timeout = options[:open_timeout] || 15 if connection.ssl? http.use_ssl = true if connection.ssl_verify_peer? http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.ca_file = connection.ssl_ca_file if connection.ssl_ca_file http.ca_path = connection.ssl_ca_path if connection.ssl_ca_path else http.verify_mode = OpenSSL::SSL::VERIFY_NONE end else http.use_ssl = false end http.start Session.new(http, connection.key) end