Sha256: e85d3aea22165bfcd9ef8971ebeb72e7ce05dff77e3c1f13a429f35d6d4b955e

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

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


module Whois
  class Server
    module Adapters

      #
      # = Afilias Adapter
      #
      # Provides ability to query Afilias WHOIS interfaces.
      #
      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)
          buffer_append response, host

          if options[:referral] != false && referral = extract_referral(response)
            response = query_the_socket(string, referral)
            buffer_append(response, referral)
          end
        end


        private

        def extract_referral(response)
          if response =~ /Domain Name:/
            response.slice(/Whois Server:(\S+)/, 1)
          end
        end

      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
whois-3.6.2 lib/whois/server/adapters/afilias.rb
whois-3.6.1 lib/whois/server/adapters/afilias.rb
whois-3.6.0 lib/whois/server/adapters/afilias.rb
whois-3.5.9 lib/whois/server/adapters/afilias.rb
whois-3.5.8 lib/whois/server/adapters/afilias.rb
whois-3.5.7 lib/whois/server/adapters/afilias.rb
whois-3.5.6 lib/whois/server/adapters/afilias.rb
whois-3.5.5 lib/whois/server/adapters/afilias.rb
whois-3.5.4 lib/whois/server/adapters/afilias.rb
whois-3.5.3 lib/whois/server/adapters/afilias.rb
whois-3.5.2 lib/whois/server/adapters/afilias.rb
whois-3.5.1 lib/whois/server/adapters/afilias.rb
whois-3.5.0 lib/whois/server/adapters/afilias.rb
whois-3.4.5 lib/whois/server/adapters/afilias.rb
whois-3.4.4 lib/whois/server/adapters/afilias.rb