Sha256: 6c44d677eec288c53571cfcee66ac10952623aa7941348c07ba770228552927c

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
#++


module Whois
  class Server
    module Adapters

      #
      # = Afilias Adapter
      #
      # Provides ability to query Afilias WHOIS interfaces.
      #
      # The following WHOIS servers are currently known
      # to require the Afilias adapter:
      #
      # - whois.afilias-grs.info
      #
      class Afilias < Base

        # Executes a WHOIS query to the Afilias WHOIS interface,
        # resolving any intermediate referral,
        # and appends the response to the client buffer.
        #
        # @param  [String] string
        # @return [void]
        #
        def request(string)
          response = query_the_socket(string, host, DEFAULT_WHOIS_PORT)
          buffer_append response, host

          if endpoint = extract_referral(response)
            response = query_the_socket(string, endpoint, DEFAULT_WHOIS_PORT)
            buffer_append response, endpoint
          end
        end


        private

          def extract_referral(response)
            if response =~ /Domain Name:/ && response =~ /Whois Server:(\S+)/
              $1
            end
          end

      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
whois-2.2.0 lib/whois/server/adapters/afilias.rb
whois-2.1.0 lib/whois/server/adapters/afilias.rb
whois-2.0.7 lib/whois/server/adapters/afilias.rb
whois-2.0.6 lib/whois/server/adapters/afilias.rb
whois-2.0.5 lib/whois/server/adapters/afilias.rb
whois-2.0.4 lib/whois/server/adapters/afilias.rb
whois-2.0.3 lib/whois/server/adapters/afilias.rb
whois-2.0.2 lib/whois/server/adapters/afilias.rb
whois-2.0.1 lib/whois/server/adapters/afilias.rb
whois-2.0.0 lib/whois/server/adapters/afilias.rb