@private
# File lib/net/http/connection_pool/session.rb, line 55 def for connection, open_timeout 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($stdout) http.open_timeout = open_timeout 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
# File lib/net/http/connection_pool/session.rb, line 23 def initialize http_session, key @http_session = http_session @key = key @created_at = Time.now @last_used_at = nil end
@return [nil]
# File lib/net/http/connection_pool/session.rb, line 45 def finish begin http_session.finish if http_session.started? rescue IOError end nil end
# File lib/net/http/connection_pool/session.rb, line 38 def request *args, &block response = http_session.request(*args, &block) @last_used_at = Time.now response end