# File lib/net/http/connection_pool.rb, line 119 def request connection, *request_args, &block session = nil response = nil retried = false begin session = session_for(connection, retried) session.http_session.read_timeout = connection.read_timeout response = session.request(*request_args, &block) rescue Exception => error # close the http session to prevent the connection from being # left open and risk the other side sending data session.finish if session # retry socket errors once on a new session if SOCKET_ERRORS.include?(error.class) and !retried retried = true retry end raise error else @pool_mutex.synchronize { @pool << session } end response end