Sha256: 73edbfe5f5ce6ba58bc4abb14a50f506f7d6d395076d084664def8be43010a3b

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 KB

Contents

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


module Whois
  class Server
    module Adapters

      #
      # = Public Internet Registry (PIR) Adapter
      #
      # Provides ability to query PIR WHOIS interfaces.
      #
      # The following WHOIS servers are currently known
      # to require the Pir adapter:
      #
      # - whois.publicinterestregistry.net
      #
      class Pir < Base

        # Executes a WHOIS query to the PIR 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("FULL #{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 =~ /Registrant Name:SEE SPONSORING REGISTRAR/ &&
               response =~ /Registrant Street1:Whois Server:(\S+)/
              $1
            end
          end

      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
whois-2.6.3 lib/whois/server/adapters/pir.rb
whois-2.6.2 lib/whois/server/adapters/pir.rb
whois-2.6.1 lib/whois/server/adapters/pir.rb
whois-2.6.0 lib/whois/server/adapters/pir.rb
whois-2.5.1 lib/whois/server/adapters/pir.rb
whois-2.5.0 lib/whois/server/adapters/pir.rb
whois-2.4.0 lib/whois/server/adapters/pir.rb
whois-2.3.0 lib/whois/server/adapters/pir.rb