class HTTP::Client
def verify_connection!(uri)
def verify_connection!(uri) if default_options.persistent? && uri.origin != default_options.persistent raise StateError, "Persistence is enabled for #{default_options.persistent}, but we got #{uri.origin}" end # We re-create the connection object because we want to let prior requests # lazily load the body as long as possible, and this mimics prior functionality. return close if @connection && (!@connection.keep_alive? || @connection.expired?) # If we get into a bad state (eg, Timeout.timeout ensure being killed) # close the connection to prevent potential for mixed responses. return close if @state == :dirty end