lib/mongo/uri/srv_protocol.rb
def parse!(remaining)
        super

        if @servers.length != 1
          raise_invalid_error!(INVALID_HOST)
        end
        hostname = @servers.first
        validate_srv_hostname(hostname)
        @query_hostname = hostname

        @srv_result = resolver.get_records(hostname)
        if srv_result.empty?
          raise Error::NoSRVRecords.new(NO_SRV_RECORDS % hostname)
        end
        @txt_options = get_txt_options(hostname) || {}
        records = srv_result.address_strs
        records.each do |record|
          validate_address_str!(record)
        end
        @servers = records
      rescue Error::InvalidAddress => e
        raise_invalid_error!(e.message)
      end
# Parses the credentials from the URI and performs DNS queries to obtain
# the hosts and TXT options.
#
# @param [ String ] remaining The portion of the URI pertaining to the
#   authentication credentials and the hosts.
Parses the credentials from the URI and performs DNS queries to obtain
the hosts and TXT options.
Parses the credentials from the URI and performs DNS queries to obtain the hosts and TXT options .
def parse!(remaining)
        super
        if @servers.length != 1
          raise_invalid_error!(INVALID_HOST)
        end
        hostname = @servers.first
        validate_srv_hostname(hostname)
        @query_hostname = hostname
        @srv_result = resolver.get_records(hostname)
        if srv_result.empty?
          raise Error::NoSRVRecords.new(NO_SRV_RECORDS % hostname)
        end
        @txt_options = get_txt_options(hostname) || {}
        records = srv_result.address_strs
        records.each do |record|
          validate_address_str!(record)
        end
        @servers = records
      rescue Error::InvalidAddress => e
        raise_invalid_error!(e.message)
      end
def parse! ( remaining ) super if @servers . length != 1 raise_invalid_error! ( INVALID_HOST ) end hostname = @servers . first validate_srv_hostname ( hostname ) @query_hostname = hostname @srv_result = resolver . get_records ( hostname ) if srv_result . empty? raise Error :: NoSRVRecords . new ( NO_SRV_RECORDS % hostname ) end @txt_options = get_txt_options ( hostname ) || { } records = srv_result . address_strs records . each do | record | validate_address_str! ( record ) end @servers = records rescue Error :: InvalidAddress => e raise_invalid_error! ( e . message ) end
Parses the credentials from the URI and performs DNS queries to obtain
the hosts and TXT options.
Parses the credentials from the URI and performs DNS queries to obtain the hosts and TXT options .
remaining
remaining The portion of the URI pertaining to the authentication credentials and the hosts.
remaining The portion of the URI pertaining to the authentication credentials and the hosts .