class HTTPX::Resolver::System

  1. lib/httpx/resolver/system.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. <<
  2. closed?
  3. empty?
  4. uncache

Included modules

  1. Resolver::ResolverMixin

Constants

RESOLV_ERRORS = [Resolv::ResolvError, Resolv::DNS::Requester::RequestError, Resolv::DNS::EncodeError, Resolv::DNS::DecodeError].freeze  

Public Class methods

new (options)
[show source]
   # File lib/httpx/resolver/system.rb
15 def initialize(options)
16   @options = Options.new(options)
17   @resolver_options = Resolver::Options.new(@options.resolver_options)
18   @state = :idle
19   resolv_options = @resolver_options.to_h
20   timeouts = resolv_options.delete(:timeouts)
21   resolv_options.delete(:cache)
22   @resolver = Resolv::DNS.new(resolv_options.empty? ? nil : resolv_options)
23   @resolver.timeouts = timeouts if timeouts
24 end

Public Instance methods

<< (connection)
[show source]
   # File lib/httpx/resolver/system.rb
34 def <<(connection)
35   hostname = connection.origin.host
36   addresses = connection.addresses ||
37               ip_resolve(hostname) ||
38               system_resolve(hostname) ||
39               @resolver.getaddresses(hostname)
40   throw(:resolve_error, resolve_error(hostname)) if addresses.empty?
41 
42   emit_addresses(connection, addresses)
43 rescue Errno::EHOSTUNREACH, *RESOLV_ERRORS => e
44   emit_resolve_error(connection, hostname, e)
45 end
closed? ()
[show source]
   # File lib/httpx/resolver/system.rb
26 def closed?
27   true
28 end
empty? ()
[show source]
   # File lib/httpx/resolver/system.rb
30 def empty?
31   true
32 end
uncache (*)
[show source]
   # File lib/httpx/resolver/system.rb
47 def uncache(*); end